大佬教程收集整理的这篇文章主要介绍了asp.net – 默认情况下提供静态文件index.html,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
public class Startup { public void Configureservices(IserviceCollection services) { } public void Configure(IApplicationBuilder app) { app.UseIISPlatformHandler(); app.UseStaticFiles(); } // Entry point for the application. public static void Main(String[] args) => WebApplication.Run<Startup>(args); }
每当我使用IIS Express或web启动项目时,我总是必须导航到/index.html.我该如何制作它以便我可以访问根(/)并仍然获得index.html?
public void Configure(IApplicationBuilder application) { ... // Enable serving of static files from the wwwroot folder. application.UseStaticFiles(); // Serve the default file,if present. application.UseDefaultFiles(); ... }
或者,您可以使用UseFileServer方法,该方法使用单行而不是两行来执行相同的操作.
public void Configure(IApplicationBuilder application) { ... application.UseFileServer(); ... }
有关更多信息,请参见documentation.
以上是大佬教程为你收集整理的asp.net – 默认情况下提供静态文件index.html全部内容,希望文章能够帮你解决asp.net – 默认情况下提供静态文件index.html所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。