Search code examples
c#linuxasp.net-corehttp-status-code-404

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


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?


Solution

  • 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.