ASP.net 4.0 default.aspx problem on IIS6
Asked Answered
D

7

11

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.

Dogtrot answered 14/4, 2010 at 6:33 Comment(0)
J
20

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

  1. Create a new DWORD value named EnableExtensionlessUrls.
  2. Set EnableExtensionlessUrls to 0. This enables extensionless URL behavior.
  3. Save the registry value and close the registry editor.
  4. Run the iisreset command-line tool, which causes IIS to read the new registry value.
Jotun answered 15/6, 2010 at 22:10 Comment(2)
Just as a heads for for anyone who runs into this issue, we found that installing the hotfix for this issue #3721220 erased this reg key, which re-created this issue. Once we re-applied this fix, default documents worked correctly againDispersal
worked for me on WIN2003 SP2 / IIS 6 / .NET 4. additional MSDN blog article on the issue here: How to Disable the ASP.NET v4.0 Extensionless URL feature on IIS 6.0Yaker
R
4

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

Rainband answered 15/4, 2010 at 6:45 Comment(2)
.net 4.0 isapi extension is enabled. Site works fine. Still have no answerDogtrot
Run cscript iisext.vbs /EnFile C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll and then restart IISDevotee
S
2

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.

Script answered 19/8, 2015 at 9:50 Comment(0)
S
1

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.

Spradling answered 12/10, 2010 at 16:2 Comment(0)
B
1

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 :

RewriteRule ^(.*)/eurl.axd/[a-f0-9]{32}(.*)$ $1$2

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.

Beachhead answered 10/2, 2011 at 15:49 Comment(0)
B
0

Are you sure it's default.aspx not default.asp in the list of default documents?

Bemused answered 14/4, 2010 at 6:36 Comment(2)
absolutely. The first number in the listDogtrot
Did you add it yourself or was it already there? Is there any chance it could be a typo?Bemused
O
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.

Officialese answered 12/8, 2011 at 19:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.