Could not load type System.ServiceModel.Activation.HttpModule解决办法

在Windows Server 2008中的IIS服务器中部署WCF服务程序时,通过浏览器访问报出如下错误:

未能从程序集“System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”中加载类型“System.ServiceModel.Activation.HttpModule”。

原因:

这是因为先安装了 .NET Framework 4,随后启用了 .NET Framework 3.5 WCF HTTP 激活,则会发生此错误。

解决办法:
cmd进入命令行界面,然后进入framework的文件夹(C:\Windows\Microsoft.NETFramework),选择相应的版本下的文件夹(v4.0.30319),使用命令: aspnet_regiis.exe -iru 等注册完成后网站就可以打开了

程序运行报:the server was unable to process the request due to an internal error. for more information about the error, either turn on includeexceptiondetailinfaults (either from servicebehaviorattribute or from the configuration behavior)on the server in order to send the exception information back to the client, or turn on tracing as per the microsoft.net framework 3.0 sdk documentation and inspect the server trace logs

是iis没开兼容32位导致的