Wednesday, October 24, 2012

Server Error 500.0 ASP.Net 4, Windows Server 2008 R2, IIS 7.5

I set up a new server to be a test environment for our production server.  When I installed it and tried to run the web site I got a .Net error that was telling me that my config file wanted version 4 of the .Net frame work.

Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

I found that I needed to go to the application pool and set its >Net framework version to 4.0. It was set to 2.0

When the page loaded I got "HTTP Error 500.0 - Internal Server Error" in the browser.

I checked the event log and got "An application has reported as being unhealthy."

I found solutions online that said stop and restart the application pool.  That did not help.

I found solutions that talked about running a command from the .Net folder that would repair .Net.  I think the program they suggested running was aspnet_regiis.exe.  That did not help.

I looked and saw that Microsoft .Net Framework 4 Extended was missing in Programs and Features in Control Panel.  I downloaded and installed the full version of the .Net Framework.  I think I may have only installed the Client Profile.  Once I did the install it added Microsoft .Net Framework 4 Extended, but did not fix the problem.

After more research I uninstalled both Microsoft .Net Framework 4 Extended and also Microsoft .Net Framework 4 Client Profile and reinstalled the full version of the .Net Framework version 4.

After that i got a different error, but I think that has to do with the configuration of my code.  At least now it appears to be at least getting to .Net and .Net is trying to process the page.  I think the previous error was indicating that IIS was not able to pass off to .Net.

A friend of mine has the theory that I had installed .Net before IIS and that is why it was confused.  He said that IIS needs to be installed first for ASP.Net to get configured correctly.  Not sure if that is what happened here or not, but it does make sense what he is saying.