【发布时间】:2019-12-03 09:43:57
【问题描述】:
我在 css 文件夹和 js 文件夹的 wwwroot 中添加样式表和 JavaScript,当我尝试在 layout.chtml 中使用它时,它总是返回 404this example of my wwwrot
startup.cs
`
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddMemoryCache();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.Use(next => context =>
{
if (string.Equals(context.Request.Headers["X-Forwarded-Proto"], "https", StringComparison.OrdinalIgnoreCase))
{
context.Request.Scheme = "https";
}
return next(context);
});
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
app.UseSession();
app.UseAuthentication();
app.UseMvc();
}`
【问题讨论】:
-
您能否将
Configure中的Startup.cs方法包含在内?