Asp.Net Core Web Application Static Files Gives 404 on Linux

断了今生、忘了曾经 提交于 2019-12-13 15:30:57

问题


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());
}

Any idea how to get it running on Linux?


回答1:


Turns out somehow directories are case sensetive.
I cannot get content/bootstrap.css however, Content/bootstrap.css works fine. So I renamed folders and files accordingly and everything works fine now.



来源:https://stackoverflow.com/questions/38523916/asp-net-core-web-application-static-files-gives-404-on-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!