Thursday, February 3, 2011

500 Internal Server Error after changing .NET Framework Version to 4.0 in IIS7

Hello,
I just changed my .NET Framework Version of the Application Pools in IIS7 Manager, following these instructions. 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 on 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"."

I am sure that I have installed ASP.NET completely.

Please help me,
-René

  • You need to make sure that each app in any given app pool targets the same version of the .NET framework. If you have mixed versions then you need to create multiple app pools.

    René : You can't change the .NET version of a single application, it is determined by the application pool it is in.
    From squillman
  • 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)

    René : 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.
    Jim B : 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.
    From Jim B
  • I found the solution. Apparently, it did not register my .NET 4.0 installation, I simply had to open Start->Computer->Run, and type in: "C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i", and it fixed it! Thanks anyways.

    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 was installed!
    To see what path you need, open "C:\Windows\Microsoft.NET\Framework\", and see what the folder's name is, and adjust it accordingly, like so: "C:\Windows\Microsoft.NET\Framework\ FOLDER NAME \aspnet_regiis.exe"

    From René

0 comments:

Post a Comment