我正在尝试在Windows Server 2012 build 8400上的IIS8上运行WCF服务。

在安装web角色时,WCF的东西(在3.51之下)没有像Windows Server 2008那样被发现。

当安装svc处理程序映射是缺失的,所以我做了一个:

%windir%\Microsoft.NET\Framework\v3.0\WindowsCommunication Foundation\ServiceModelReg.exe –i

现在处理程序映射在那里,但我仍然得到:

The resource you are looking for does not have a handler associated with it.

(我删除了静态文件处理程序。)

为了使用模拟,该站点正在使用经典的管道。


当前回答

更具体地说:

Run Server Manager (on task bar and start menu) Choose the server to administer (probably local server) Scroll down to "Roles and Features" section. Choose "Add Role or Feature" from Tasks drop down On "Add Role or Feature Wizard" dialog, click down to "Features" in list of pages on the left. Expand ".Net 3.5" or ".Net 4.5", depending on what you have installed. (you can go back up to "roles" screen to add if you don't have. Under "WCF Services", check the box for "HTTP-Activation". You can also add non-http types if you know you need them (tcp, named pipes, etc). Click "Install" Button.

其他回答

在windows 10(客户端)上,你也可以使用脚本

Enable-WindowsOptionalFeature -Online -NoRestart -FeatureName WCF-HTTP-Activation45 -All

注意,这是一个不同于服务器skus的命令

使用PowerShell,您可以安装所需的功能:

Add-WindowsFeature 'NET-HTTP-Activation'

它是。net框架的HTTP激活特性 Windows进程激活功能也是必需的

现在我更喜欢通过脚本来实现这一点

REM install the needed Windows IIS features for WCF
dism /Online /Enable-Feature /FeatureName:WAS-WindowsActivationService
dism /Online /Enable-Feature /FeatureName:WAS-ProcessModel
dism /Online /Enable-Feature /FeatureName:WAS-NetFxEnvironment
dism /Online /Enable-Feature /FeatureName:WAS-ConfigurationAPI
dism /Online /Enable-Feature /FeatureName:WCF-HTTP-Activation
dism /Online /Enable-Feature /FeatureName:WCF-HTTP-Activation45

REM Feature Install Complete
pause

对于Windows 8机器,没有“服务器管理器”应用程序(至少我没能找到它)。

不过我还是解决了这个问题。我不确定我在哪个顺序做了以下操作,但看起来以下操作中的一个/几个有帮助:

Turn ON the following on 'Turn Windows Features on or off' a) .Net Framework 3.5 - WCF HTTP Activation and Non-Http Activation b) all under WCF Services (as specified in one of the answers to this question) executed "ServiceModelReg.exe –i" in "%windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\" folder Registered ASP.NET 2.0 via two commands ( in folder C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727): aspnet_regiis -ga "NT AUTHORITY\NETWORK SERVICE" aspnet_regiis -iru Restarted PC... it looks like as a result as actions ## 3 and 4 something got broken in my ASP.NET configuration Repeat action #2 Install two other options from the "Programs and Features": .Net Framework 4.5 Advanced Services. I checked both sub options: ASP.NET 4.5 and WCF services Restart App Pool.

序列有点疯狂,但这对我有帮助,可能也会对其他人有帮助