HTTP 错误 404.0 - 未找到,错误代码 0x80070002;在 IIS 中路由无扩展名 url
HTTP Error 404.0 - Not Found, Error Code 0x80070002; routing extensionless url in IIS
看了很多文章,测试了,还是没有解决我的问题
我用 UrlRoutingModule
有友情 URL
在global.asax.cs
中:
routes.MapPageRoute("", "HOME", "~/Default.aspx");
在web.config中:
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>`
在 IIS 中,应用程序池处于经典模式
测试了以下解决方案:
- 添加到 web.config
<modules runAllManagedModulesForAllRequests="true">
- 添加到 web.config
<validation validateIntegratedModeConfiguration="false" />
- 添加到 web.config
<remove name="UrlRoutingModule"/>
- 启用 IIS 服务"HTTP Redirection"
- 启用 IIS 服务"HTTP Error"
- 启用 IIS 服务"HTTP Logging"
- 启用 IIS 服务"Static Content Compression"
- 启用 IIS 服务"Dynamic Content Compression"
- 启用 IIS 服务"Request Monitor"
- 重新安装 IIS!
注一:
路由在扩展 URL 上工作,例如当我将 global.asax.cs
中的路由规则更改为
routes.MapPageRoute("", "HOME.aspx", "~/Default.aspx");
URL"mysite/HOME.aspx"有效
注2:
在这种情况下,这个配置在另外 2 个服务器上运行!
注3:
在此服务器上,路由通过将应用程序池设置为 integrated mode
+ <validation validateIntegratedModeConfiguration="false" />
这有点瞎猜,因为您提到此配置在某些服务器上有效,但在其他服务器上无效。
如 this post, there is a bug in IIS that Microsoft has released a hotfix for 中所述,您可能需要检查服务器以查看它们是否已针对 KB980368 进行了一致的修补。
正如文章指出的那样,该问题仅适用于 .NET 4.0。由于您(显然)正在使用 .NET 3.5,您可能希望 double-check 您的应用程序池配置以确保它们都一致地设置为 .NET 2.0 和您的 web.config settings to ensure you are targeting .NET 3.5.
Do note that Microsoft officially ended support for .NET 4.0 on January 12, 2016, but support for .NET 3.5 SP1 will will continue until support ends for the OS you are hosting it on.
看了很多文章,测试了,还是没有解决我的问题
我用 UrlRoutingModule
有友情 URL
在global.asax.cs
中:
routes.MapPageRoute("", "HOME", "~/Default.aspx");
在web.config中:
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>`
在 IIS 中,应用程序池处于经典模式
测试了以下解决方案:
- 添加到 web.config
<modules runAllManagedModulesForAllRequests="true">
- 添加到 web.config
<validation validateIntegratedModeConfiguration="false" />
- 添加到 web.config
<remove name="UrlRoutingModule"/>
- 启用 IIS 服务"HTTP Redirection"
- 启用 IIS 服务"HTTP Error"
- 启用 IIS 服务"HTTP Logging"
- 启用 IIS 服务"Static Content Compression"
- 启用 IIS 服务"Dynamic Content Compression"
- 启用 IIS 服务"Request Monitor"
- 重新安装 IIS!
注一:
路由在扩展 URL 上工作,例如当我将 global.asax.cs
中的路由规则更改为
routes.MapPageRoute("", "HOME.aspx", "~/Default.aspx");
URL"mysite/HOME.aspx"有效
注2:
在这种情况下,这个配置在另外 2 个服务器上运行!
注3:
在此服务器上,路由通过将应用程序池设置为 integrated mode
+ <validation validateIntegratedModeConfiguration="false" />
这有点瞎猜,因为您提到此配置在某些服务器上有效,但在其他服务器上无效。
如 this post, there is a bug in IIS that Microsoft has released a hotfix for 中所述,您可能需要检查服务器以查看它们是否已针对 KB980368 进行了一致的修补。
正如文章指出的那样,该问题仅适用于 .NET 4.0。由于您(显然)正在使用 .NET 3.5,您可能希望 double-check 您的应用程序池配置以确保它们都一致地设置为 .NET 2.0 和您的 web.config settings to ensure you are targeting .NET 3.5.
Do note that Microsoft officially ended support for .NET 4.0 on January 12, 2016, but support for .NET 3.5 SP1 will will continue until support ends for the OS you are hosting it on.