Asp.Net核心Web应用程序静态文件在Linux上提供404 [英] Asp.Net Core Web Application Static Files Gives 404 on Linux

查看:82
本文介绍了Asp.Net核心Web应用程序静态文件在Linux上提供404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用.net core创建了一个Web应用程序.我已经成功地使其在Windows和Mac上运行.但是我在Linux上的所有静态文件上都得到404.我正在使用Ubuntu 16.04,而startup.cs就是这样.

I have created a web application using .net core. I have successfully get it running on Windows and Mac. However I get 404 on all my static files on Linux. I am using Ubuntu 16.04 and my startup.cs is like this.

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory,IApplicationLifetime appLifetime)
{
    loggerFactory.AddConsole(Configuration.GetSection("Logging"));
    loggerFactory.AddDebug();

    app.UseMvc();
    app.UseDefaultFiles();
    app.UseStaticFiles();

    appLifetime.ApplicationStopped.Register(() => this.ApplicationContainer.Dispose());
}

有什么想法如何使其在Linux上运行?

Any idea how to get it running on Linux?

推荐答案

显示目录为区分大小写.
该应用程序无法解析content/bootstrap.css.但是,Content/bootstrap.css正在解析.因此,我相应地重命名了文件夹和文件,一切正常.

Turns out directories are case sensetive.
The app was not able to resolve content/bootstrap.css. However, Content/bootstrap.css was resolving. So I renamed the folders and files accordingly and everything works fine.

这篇关于Asp.Net核心Web应用程序静态文件在Linux上提供404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆