PowerShell ASP: Could not load file or assembly nsoftware.PowerShellASP in IIS.

Problem Description

When creating a handler mapper to support PowerShell ASP in IIS you can sometimes get the following error:

Could not load file or assembly nsoftware.PowerShellASP or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. (c:\windows\microsoft.net\framework64\v2.0.50727\config\web.config line 59)

Cause

This error occurs when PowerShell Server was installed with PowerShell 3.0 support but the IIS Application Pool using the PowerShell ASP handler mapping is configured to run under .NET 2.0. Because PowerShell 3.0 requires .NET 4.0 this error is generated.

Resolution

To resolve this issue all you must do is set the Application Pool to use .NET 4.0. This can be done by the following steps:

  1. In IIS, expand the Server branch.
  2. Select “Application Pool”.
  3. Right-click the Application Pool being used for your PowerShell ASP site and select “Basic Settings”.
  4. Under the “.NET Framework Version” select the .NET 4.0 option (e.g., “.NET 4.0.30319″)
  5. Click “OK”.
  6. Restart IIS.

We appreciate your feedback.  If you have any questions, comments, or suggestions about this article please contact our support team at kb@nsoftware.com.