Fixing common issues when hosting a .NET 4.0 WCF service in IIS 7
http://sandrinodimattia.net/fixing-common-issues-when-hosting-a-net-4-0-wcf-service-in-iis-7/
Until today I never had to host a WCF service in IIS… I always prefered using a ServiceHost in a Windows Service. Before getting my service up and running I had to face some issues.
Could not load file or assembly ‘service’ or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
The problem here is that I’m running a .NET 4.0 service in a .NET 2.0 IIS and AppPool. I had to make the following changes:
- Change the IIS .NET Framework version to v4.0.30319 (click on the machine name in IIS Manager and in the right pane choose Change .NET Framework Version)
- Change the .NET Framework version of the AppPool too v4.0 (via Application Pools) or create a new Application Pool.
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map. Detailed Error InformationModule StaticFileModule.
The reason for this issue: the ServiceModel for .NET 4.0 was not installed. Run ServiceModelReg.exe -ia to solve this.
Depending on your machine and the .NET version you are running the file could be in one of the following locations:
- C:\Windows\Microsoft.NET\Framework\v4.0.30319\
- C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
Handler "svc-Integrated" has a bad module "ManagedPipelineHandler" in its module list
- This means that ASP.NET 4.0 was not installed (correctly). Run aspnet_regiis.exe -i using Visual Studio Command Prompt (2010) or via "C:\Windows\Microsoft.NET\Framework\v4.0.30319".
- I also had to install the WCF Activation feature under .NET Framework 3.5.1 Features
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了