Wednesday, 27 February 2008

Windows 2003 IIS returns 404 for ASP.Net pages

Had an issue on one of our externally managed servers which wouldn't process any ASP.Net documents (aspx, asmx etc), but would just return a 404. However, it would happily return other files such as htm, txt, css. There was no web application logging, no logs in event viewer I had nothing to go on, until I remembered about the often forgotten and rarely used IIS logs (see my article on where are my iis logs to find yours :).

The logs showed requests for the ASP.Net documents and that a 404 was being returned. This part wasn't helpful but the logs also provide a sub status code which was 2:

#Fields: date time s-sitename s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip sc-status sc-substatus 
2008-02-27 12:39:13 W3SVC2 127.0.0.1 GET /default.aspx - 80 - 127.0.0.1 404 2

A quick Google led me to Microsofts IIS 6 pages explaining the sub status codes - bingo!

404.2 : "Web service extension lockdown policy prevents this request"

Knowing this and with the power of Google I resolved the issue in less than a minute. Just open the IIS6 interface, select the Web Service Extensions menu node, on the right you will see the web service extensions available - just select the ASP.Net extension and click the allow button.

IIS Web Extensions Menu

13 comments:

Rachel Goldthorpe said...

Thanks for this! We were having the same problem in a vanilla VM build, one search and it was solved :)

Neil kilbride said...

Glad I could help a fellow EPi-slave!

Sjoerd Perfors said...

Hi Thanks for this and i have another question. How did you post the code in a nice box like the 2 lines above? I would like to add this to my blog also if thats possible.

Thanks in advance,

Sjoerd

Neil kilbride said...

Glad it helped. To get that style you need to place content in a blockquote tag like so:

<blockquote>
404.2 : "Web service extension lockdown policy prevents this request"
</blockquote>

And have some CSS like so:

blockquote {
border-color:#DDEECC;
border-style:solid;
border-width:2px 0pt; }

But you could do it with any HTML tag or a simple CSS class on a span or div.

Sjoerd Perfors said...

Hi Neil,

No i ment the other textbox, with the line number in it and copy to clipboard.

Sjoerd Perfors said...

Nevermind i just saw the question mark:

dp.SyntaxHighlighter

Version: 1.5.1

Anonymous said...

Thanks so much! My problem was with classic .asp pages but, this helped as I looked at the ISAPI filter and it was not allowed. Click, click, bam! It works! Thanks for your post!

Alex Lindgren said...

Thanks for the tip! I had this problem when I was trying out Amazon's EC2. After reading your post, I was able to figure out that I needed to register ASP.NET 2 as well (C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i -enable) because the Amazon Windows image didn't have it registered for some reason.

Anonymous said...

Thanks a bunch! I was looking everywhere without luck, until I stubmled onto your article.

Steffen Enni said...

Thanks for this. It helped me a lot.

KC said...

Thanks Neil and Alex, your post and comment helped me out on a fresh W2003 box where my IIS wasn't serving up ASP.NET files and I only got 404.

Binkel Noebelman said...

Thanks a lot, this tipped me off in the right direction!

I had just installed .NET 4.0 and my ASP.NET 4.0-application would not work. But after enabling the extension it does!

Anonymous said...

Now that was a day of fun I didnt need to have. THank you so much, I was looking in all of the wrong places.