简体   繁体   中英

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?

Turns out directories are .
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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM