首页 > 代码库 > wcf问题集锦

wcf问题集锦

1.处理程序“svc-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler”

  1. HTTP 错误 404.3 - Not Found

    由于扩展配置问题而无法提供您请求的页面。如果该页面是脚本,请添加处理程序。如果应下载文件,请添加 MIME 映射。

    解决办法:以管理员运行命令:C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe -i

  2.  HTTP 错误 500.21 - Internal Server Error 

    处理程序“svc-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler”

    解决办法:

    原因:在安装Framework v4.0之后,再启用IIS,导致Framework没有完全安装

    解决:开始->所有程序->附件->鼠标右键点击“命令提示符”->以管理员身份运行->%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

    如果还不行,可检查IIS的应用程序池,是否使用集成模式,如果不是则改成集成模式

2.WCF Add Service Reference gotcha with Windows Server

We recently switched from developing in Vista to Windows Server 2003. Someone had the bright idea that we should develop in the same environment the application is going to be hosted on. Go figure.

What that meant is that you run into wierd issues like this one. When trying to add a Service Reference to a WCF service hosted under IIS you keep getting this ‘Add Service Reference Error‘:

Metadata contains a reference that cannot be resolved: ‘http://merill/Services.Host/ClientProfile.svc?wsdl‘.
The WSDL document contains links that could not be resolved.
There was an error downloading ‘http://merill/Services.Host/ClientProfile.svc?xsd=xsd0‘.
The underlying connection was closed: An unexpected error occurred on a receive.
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host
Metadata contains a reference that cannot be resolved: ‘http://localhost/Services.Host/ClientProfile.svc‘.
Metadata contains a reference that cannot be resolved: ‘http://localhost/Services.Host/ClientProfile.svc‘.
If the service is defined in the current solution, try building the solution and adding the service reference again.

The key part of this message is the reference to the downloading of the xsd. When I tried accessing the .svc url in a browser it worked fine, but trying to access the .svc?xsd=xsd0 brings up the generic ‘cannot display webpage‘ message.

When you unleash your weapon (Process Monitor) on the csc.exe process (this is the compiler generating the xsd) you‘ll realise that the IIS identity IIS_WPG does not have access to the Windows\Temp folder. Give enough rights to the folder and viola problemo solved.

Reference:http://merill.net/2008/04/wcf-add-service-reference-gotcha-with-windows-server/

3.