IIS6 上的 ASP.net 4.0 default.aspx 问题
我在 Windows 2003 enterprise x64 上安装了 .net Framework 4,编写了简单的 asp.net 4.0 应用程序(仅限 default.aspx 页面)。如果请求是针对 default.aspx,而不是针对根站点,则该应用程序运行良好:
contoso.com/ - 不起作用(获取 404 错误)
contoso.com/default.aspx - 起作用。
Default.aspx 位于 IIS 中的默认文档列表中。 请帮忙。
I installed .net framework 4 on my windows 2003 enterprise x64, wrote simple asp.net 4.0 application (default.aspx page only). The application works great if request is to default.aspx, not to the root site:
contoso.com/ - doesn't work (Get 404 error)
contoso.com/default.aspx - works.
Default.aspx is in list of default documents in IIS.
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您确定默认文件列表中是default.aspx而不是default.asp吗?
Are you sure it's default.aspx not default.asp in the list of default documents?
如果同一站点上有另一个虚拟目录设置为 4.0 并且 DefaultWebSite 设置为使用 ASP.NET 4.0,则在 IIS6 中的 ASP.NET 2.0 虚拟目录上也会出现此错误。
解决方案是将DefaultWebSite 更改回ASP.NET 2.0。您的 4.0 虚拟目录仍然可以在该网站下正常运行。
You will also get this error on ASP.NET 2.0 virtual directories in IIS6 if you have another virtual directory on the same site that is set to 4.0 and the DefaultWebSite is set to use ASP.NET 4.0.
The solution is to change the DefaultWebSite back to the ASP.NET 2.0. Your 4.0 virtual directory will still do fine underneath that web site.
我使用以下正则表达式作为 第一个 规则,并使用 Ionics Isapi Rewriter 来处理 IIS 6 上 ASP.NET 4 上运行的网站em> 解决 ASP.NET 4 中引入的重大更改:
这让我可以再次使用无扩展 URL。
请注意,第二组捕获查询字符串(如果存在)并将其恢复为重写的 URL。
是的,它是 是一个功能,而不是一个错误。
I use the following regex as first rule with Ionics Isapi Rewriter for web sites running on ASP.NET 4 on IIS 6 to remedy the problems caused by the breaking change introduced with ASP.NET 4 :
This let me again use extensionless urls.
Note that the second group captures the querystring if present and restitutes it to the rewritten url.
And yes, it's a feature, not a bug.
显然我没有足够的观点来发表评论,但我想说 Will WM 的解决方案对我有用。将 EnableExtensionlessUrls 添加到注册表可以解决该问题。
附带说明一下,如果您随时运行 aspnet_regiis,它将删除该值,您需要再次添加它。
I don't have enough points to comment apparently, but I wanted to say that the solution from Will WM worked for me. Adding EnableExtensionlessUrls to the registry corrected the problem.
As a side note, if your run aspnet_regiis at anytime, it will remove this value and you will need to add it again.
你会在这里找到答案
http://johan.driessen.se/archive/2010/04/13/getting-an-asp.net-4-application-to-work-on-iis6.aspx
.Net 4.0 不会' t 使其能够与 IIS 一起运行,因此您必须运行命令(在文件夹 c:\windows\system32 中):
cscript iisext.vbs /EnFile C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll
或者在您的情况下,因为您正在运行 x64
cscript iisext.vbs /EnFile C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll
You will find the answer here
http://johan.driessen.se/archive/2010/04/13/getting-an-asp.net-4-application-to-work-on-iis6.aspx
.Net 4.0 doesn't enable itself to run with IIS so you have to run the command (while in the folder c:\windows\system32):
cscript iisext.vbs /EnFile C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll
or in your case since you are running x64
cscript iisext.vbs /EnFile C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll
将 ASp.Net 版本从 4.0 更改为 2.0 并应用。并将 Asp.Net 版本恢复到 4.0。这将解决这个问题。
Change the ASp.Net Version from 4.0 to 2.0 and apply it. and revert back The Asp.Net version to 4.0. This Will address the issue.
在看似不相关的位置找到了修复 - 尝试将“EnableExtensionlessUrls”注册表项设置为 0:
ASP.NET 4 重大更改 -> ASP.NET 2.0 应用程序可能会生成引用 eurl.axd 的 HttpException 错误:
在 Windows 注册表中,打开以下节点:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\4.0.30319.0
Found a fix in a seemingly unrelated location - try setting the "EnableExtensionlessUrls" registry key to 0:
ASP.NET 4 Breaking Changes -> ASP.NET 2.0 Applications Might Generate HttpException Errors that Reference eurl.axd:
In the Windows registry, open the following node:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\4.0.30319.0