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

20,900

Solution 1

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"

Solution 2

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

aspnet_regiis.exe -i
Share:
20,900
René
Author by

René

Updated on September 17, 2022

Comments

  • René
    René over 1 year

    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"

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

  • René
    René over 13 years
    You can't change the .NET version of a single application, it is determined by the application pool it is in.
  • René
    René over 13 years
    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.
  • raja
    raja over 13 years
    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.
  • René
    René over 11 years
    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 ;)