Asp.Net核心Web应用程序静态文件在Linux上提供404

编程入门 行业动态 更新时间:2024-10-18 16:43:46
本文介绍了Asp.Net核心Web应用程序静态文件在Linux上提供404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

I have created a web application using 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

本文发布于:2023-11-13 00:27:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582906.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:静态   应用程序   核心   文件   Net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!