I just changed my .NET Framework Version of the Application Pools in IIS7 Manager, following Specify a .NET Framework Version for an Application Pool (IIS 7) instructions by Microsoft Technet. Now when I try to re-upload my ASP.NET page, it shows me a 500 - Internal server error. I have tried uploading it in .NET 2.0 (x86, x64, AnyCPU), and 4.0 (x86, x64, AnyCPU), and everything gives the same error. This is all the details the error gives me: "There is a problem with the resource you are looking for, and it cannot be displayed."

When keeping the .NET version 2.0 on the server, it works just fine. Also, when uploading index.htm, it works fine as well, it just shows the HTML page.

This is on Windows Server 2008 R2, by the way.

EDIT:

I have finally found out how to get the error details. Here they are:
Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list.
Most likely causes:

Managed handler is used; however, ASP.NET is not installed or is not installed completely.

There is a typographical error in the configuration for the handler module list.
Things you can try:

Install ASP.NET if you are using managed handler.

Ensure that the handler module's name is specified correctly. Module names are case-sensitive and use the format modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"

4 Answers
4

I found the solution. Apparently, it did not register my .NET 4.0 installation. I simply had to run this program with parameters: "C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i", and it fixed it!

Note that the path "C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe" may differ according to what version of the .NET framework is installed!
To see what path you need, open "C:\Windows\Microsoft.NET\Framework\", and see what the folders name is, and adjust it accordingly, like so: "C:\Windows\Microsoft.NET\Framework\<version>\aspnet_regiis.exe"

There are specific command consoles for specific vs versions. So it avoids this headache of long paths as that is already set in the vs specific command console. Go to VS program directory and find the command console, and when it opens , just type in

Thanks for the answer, but I feel it's better placed as a comment to the original answer. But I see you don't have enough reputation to do so. Still though, thanks for the addition. I'll see if I can confirm what you said here, and edit my answer ;)
–
RenéDec 7 '12 at 16:18

The application didn't specify what version of the framework to run against. Clearly (in this case) it want to run as a 2.0 framework. I would create another app pool and isolate this application in that app pool. you can assign a version of the framework to the app pool that is compatible (in this case 2.0)

I don't exactly understand. I want to make my website in .NET 4.0, not 2.0. I also compile it in 4.0. I have also tried setting the application pool to 4.0, and compiling as 2.0, but still getting the error.
–
RenéSep 4 '10 at 0:41

Ahh I misunderstood your question it sounded like you have a working .net 2.0 application and when you changed the app pool to start up 4.0 if failed. If applications wanted to run a particular version of .net they would need to define it in app.config and if it can't run in that app pool (because you can only load 1 version of .net per pool) you get an error.
–
Jim BSep 4 '10 at 4:27