c# – MVC6默认页面

c# – MVC6默认页面,第1张

概述也许我只是醒了太多时间并完全监督了一些事情,但我正在使用MVC6 ASP.NET 5.0开发一个AngularJS网站.在我的wwwroot里面,我有一个index.html页面,它运行得很好,但随后应用了更新,现在突然间我只得到一个空白的白色屏幕:开发人员工具告诉我: 无法加载资源:服务器响应状态为404(未找到) 在我的创业公司里面我有以下内容: public void Configure(I 也许我只是醒了太多时间并完全监督了一些事情,但我正在使用MVC6 ASP.NET 5.0开发一个AngularJs网站.在我的wwwroot里面,我有一个index.HTML页面,它运行得很好,但随后应用了更新,现在突然间我只得到一个空白的白色屏幕:开发人员工具告诉我:

无法加载资源:服务器响应状态为404(未找到)

在我的创业公司里面我有以下内容:

public voID Configure(IApplicationBuilder app){    app.UseDefaultfiles(new Microsoft.AspNet.Staticfiles.DefaultfilesOptions() { Defaultfilenames = new[] { "index.HTML" } });    app.UseMvc();}

有些原因我在调试时仍然得到一个空白的白页,没有任何加载.

解决方法 您还必须指定app.UseStaticfiles(). From the docs:

In order for your Web app to serve a default page without the user having to fully qualify the URI,call the UseDefaultfiles extension method from Startup.Configure as follows. Note that you must still call UseStaticfiles as well. This is because UseDefaultfiles is a URL re-writer that doesn’t actually serve the file. You must still specify mIDdleware (UseStaticfiles,in this case) to serve the file.

总结

以上是内存溢出为你收集整理的c# – MVC6默认页面全部内容,希望文章能够帮你解决c# – MVC6默认页面所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1246627.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-07
下一篇 2022-06-07

发表评论

登录后才能评论

评论列表(0条)

保存