Why does IIS refuse to serve ASP.NET content?

Solution 1:

I've run into this exact issue several times, and every time, the solution was to:

  1. go to the Control Panel
  2. go to the "Windows Components" area
  3. remove IIS, let it uninstall
  4. reboot
  5. re-add IIS (make sure to include the ASP.NET stuff when you check off the boxes).
  6. Run: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis.exe -I

I spent hours debugging this at a client site once, and that was the trick. Since then, every time this has happened, this was the fix.

I'm not sure what the root cause is, but we tore the IIS configuration apart once trying to figure it out, and even had Microsoft RDC'ing into the server in question for 2 or 3 hours, and they couldn't help either.

So I write it off as an undocumented bug in ASP.NET/IIS.

Solution 2:

Try this: http://localhost/blah.aspx (should be a non-existent page). If it gives you a 404 instead of the asp.net error page then asp.net isn't running, if it gives you a 403 error then the permissions for the site are wrong.

Here's a checklist that may help:

  • Is IIS running?
  • Is your website running?
  • Is the app-pool for your website working correctly?
  • Is ASP.NET installed and registered?

    cd /d %windir%\Microsoft.Net\Framework\v2.0.50727

    aspnet_regiis -ua

    aspnet_regiis -i -enable

  • Is ASP.NET running?

Check the "ASP.NET" tab in your web site's properties. Make sure it's using the right version.

  • Are permissions set up correctly?

Check the "Home Directory" tab in your site's properties, check the "Execute Permissions" setting, it should be set to allow scripts. Also check the "Web Service Extensions" to make sure asp.net is allowed to run.


Solution 3:

Open the IIS manager, click on Web Service Extensions folder in left pane. Then click on the ASP.NET Extension in the right pane and click Allow button.


Solution 4:

You don't need to uninstall/reinstall IIS to re-establish .net support, per the previous answer. Just run the aspnet_regiis.exe utility that is located in the appropriate framwork folder, e.g.:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727