美文网首页
.net项目页面加.html无法访问

.net项目页面加.html无法访问

作者: 默默前端路 | 来源:发表于2020-12-10 15:02 被阅读0次

.net默认路由不会添加.html,一般是www.xxxx.com/aa/bb
想要添加.html方法如下
1、路由添加

routes.MapRoute(  //话题页
    name: "testPage",
    url: "testPage/testPage.html",
    defaults: new { controller = "testPage", action = "test" }
);

2、在Web.config中添加

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
</system.webServer>

3、在iis中添加映射
iis面板---->找到处理程序映射-添加处理管理程序---->请求路径填*.html---->类型填System.Web.UI.PageHandlerFactory---->名称可以随意填写

PS:方法3的配置最好在服务器上面添加上,避免出现奇怪的问题

相关文章

网友评论

      本文标题:.net项目页面加.html无法访问

      本文链接:https://www.haomeiwen.com/subject/dkfrgktx.html