Asp.Net Core Web Application Static Files Gives 40

2019-07-19 16:43发布

问题:

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.