I got the same error after upgrading the IIS server to .NET 4.5.1 (previously .NET 4.0 was installed).
In my case, running aspnet_regiis
with the parameter -iru
fixed the problem, ie.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis -iru
Note: on a 64bit system you should use
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis -iru
Notes:
.NET 4.0 and higher (e.g. 4.5.1) all installs into v.4.0.30319, this has changed compared to earlier versions (you will not find a v4.5 folder). To get the installed .NET framework versions, see this answer.
The cause of this error is described here, If you want to check manually, I cite the following from this article:
This issue occurs because the Applicationhost.config file for Windows Process Activation Service (WAS) has the following section defined, and this section is incompatible with the .NET Framework 4.0:
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
This section should be defined as follows (notice the preCondition
):
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule,
System.ServiceModel, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
preCondition="managedHandler,runtimeVersionv2.0" />
Note: You can find the Applicationhost.config
file in the following location: %windir%\system32\inetsrv\config