Friday, January 14, 2011

404 when page exists - IIS 5, ASP.NET 4.0

I have a webserver running Server 2003 Datacenter and IIS 5 which is hosting a variety of ASP.NET 2.0 websites. I'm attempting to add an ASP.NET 4.0 website which I wrote via the VS2010 Beta, and I have .NET 4.0 Beta 1 installed on the server.

The website appears to be configured correctly; anonymous access is on, it points to the right folder, and is set to asp.net 4.0.

Why might it be giving me a 404 error when I browse to it, both locally and remotely?

  • Is the DNS name pointing to the right server?

    tsilb : Yep, happens when I browse to localhost or to the server by name.
    From chaos
  • Is logging turned on? If it isn't, turn it on. If it is on, check to see of a corresponding entry is written to the log file, and check to see if all its details match up.

    If no entry is being written, then it's possible that the wrong website in IIS is serving the content for your request (check the hostname it's listening on).

    Lastly, are you sure it's IIS 5? I thought 2003 shipped with IIS 6?

    tsilb : Yep; logs reflect the 404. 2009-06-22 00:09:40 192.168.0.51 GET /Default.aspx - 82 - 192.168.0.111 Mozilla/4.0+ (compatible;+MSIE+8.0;+Windows+NT+6.1; +WOW64;+Trident/4.0;+SLCC2; +.NET+CLR+2.0.50727; +.NET+CLR+3.5.30729; +.NET+CLR+3.0.30729; +Media+Center+PC+6.0; +InfoPath.2; +.NET+CLR+4.0.20506) 404 2 0
    Farseeker : Ok, well that tells us that the correct IIS site is serving the request, which is always a great start ;) IIS has a few characteristics that I can see that might cause this. I'm assuming that ASP.NET 4 is enabled in the Web Extensions? If so, then it might not be serving the content because there's no associated MIME type for ASPX (unlikely), or because the mapping for ASPX is not pointing to the runtime...
    tsilb : oh, DUH! Why would that be prohibited by default? Thanks!
    Farseeker : Yeah, I've run into that issue myself more than once with ASP.NET. In Windows 2008/IIS7 it isn't even installed by default. All attempts at increased security I guess!
    From Farseeker
  • 404 Substatus 2 in IIS means: "Web service extension lockdown policy prevents this request.", the more friendly message on IIS7 for 404.2 says "The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the web server."

    Check out the follow KB articles for possible fixes:

    http://support.microsoft.com/kb/328419/ http://support.microsoft.com/kb/328505/ http://support.microsoft.com/kb/328360/

    In IIS6 and 7 the http-sub statuses contain importand information, see http://support.microsoft.com/kb/318380 for a full list.

    Rihan Meij : I so agree, often the error message is exactly right, like 404 in IIS 5 if I recall correctly says "Resource not found" that could mean the aspx/html physical file was not found, but it could also mean that the script map is pointing to a invalid file or because of security some part of your system could not locate that spesific "resouce"
  • Check the metabase.xml file ... is there a '1' at the start of the line for Framework\V4.0.21006 in WebSvcExtRestrictionList?

    I had the same problem and setting it to '1' (enabled) cured the problem. ASP.NET 4.0 Beta 1 did not have this problem. The problem only appeared on install of ASP.NET 4.0 Beta 2.

    Here's what it looked like BEFORE fixing the problem:

     WebSvcExtRestrictionList="0,C:\SERVER\system32\inetsrv\httpodbc.dll,0,HTTPODBC,Internet Data Connector
      0,C:\Perl\bin\perlis.dll,1,,Perl ISAPI Extension
      0,C:\SERVER\system32\inetsrv\httpext.dll,0,WEBDAV,WebDAV
      0,C:\Perl\bin\PerlEx30.dll,1,,PerlEx ISAPI Extension
      0,C:\Perl\bin\perl.exe "%s" %s,1,,Perl CGI Extension
      1,C:\SERVER\system32\inetsrv\asp.dll,0,ASP,Active Server Pages
      1,C:\SERVER\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,0,ASP.NET v2.0.50727,ASP.NET v2.0.50727
      0,*.exe
      0,*.dll
      0,C:\SERVER\system32\inetsrv\ssinc.dll,0,SSINC,Server Side Includes
      0,C:\SERVER\Microsoft.NET\Framework\v4.0.21006\aspnet_isapi.dll,0,ASP.NET v4.0.21006,ASP.NET v4.0.21006"
    
  • You just need to enable the web extension for ASP.NET 4.0 in IIS.

    From Ashish
  • I have similar issue. But the system won't allow me to save the change! After changed it in notepad and tried to save. I got message "Cannot create the C:\WINDOWS\system32\inetsrv\MetaBase.xml file. Make sure that the path and filename are correct."

    From John Cheng

0 comments:

Post a Comment