gpt4 book ai didi

asp.net - IIS 7 忽略没有文件扩展名的 MapPageRoute

转载 作者:行者123 更新时间:2023-12-02 16:34:30 24 4
gpt4 key购买 nike

我有一个项目,我想在其中使用asp.net路由功能。因此,我在 global.asax Application_start 中添加了一些路由。

这在我的 Windows 7 SP1 上运行良好,但是当我将应用程序部署到 W2K8 R2 Live Server 时,我在使用 URL 时仅收到 404。如果我在 URL 末尾添加/default.aspx,页面就会正确显示。

IIS 似乎会忽略没有文件扩展名的 URL。

在本地服务器上工作,但在实时服务器上出现 404:

http://website/list/123/Test  

在两台服务器上工作:

http://website/list/123/Test/index.aspx

如何让 Live 服务器使用扩展名 less url?

最佳答案

不要忘记在 web.config 文件中添加以下内容

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

关于asp.net - IIS 7 忽略没有文件扩展名的 MapPageRoute,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5393290/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com