WCF-文档已被理解,但无法处理

时间:2009-06-12 16:39:46

标签: wcf

我有一个部署在我的测试服务器上的WCF服务。试图在我的测试项目中使用它,我添加了一个引用,我得到了这个错误

    The document was understood, but it could not be processed.
  - The WSDL document contains links that could not be resolved.
  - There was an error downloading 'http://localhost:8731/somewhere.nowhere.com/service1/?xsd=xsd2'.
  - Unable to connect to remote server
  - No connection could be made because the target machine actively refused it
Metadata contains a reference that cannot be resolved: 'http://192.1.1.1/TestService/somewhere.nowhere.com.svc?wsdl'.
Content Type application/soap+xml; charset=utf-8 was not supported by service .  The client and service bindings may be mismatched.
The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..
If the service is defined in the current solution, try building the solution and adding the service reference again.

在我将wsdlextras添加到我的服务项目中以包含wsdl文档之前,我的测试应用程序正常运行。

这是我wsdl的架构:

<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://localhost:8731/somewhere.nowhere.com/?xsd=xsd2" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://localhost:8731/somewhere.nowhere.com/?xsd=xsd1" namespace="http://schemas.datacontract.org/2004/07/TestService"/>
<xsd:import schemaLocation="http://localhost:8731/somewhere.nowhere.com/?xsd=xsd0" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://localhost:8731/somewhere.nowhere.com/?xsd=xsd3" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
</xsd:schema>
</wsdl:types>

尝试修复1: 我改变了我的

<host>
 <baseAddresses>
  <add baseAddress />
 </baseAddresses>
</host>

所以我的架构中的地址都是匹配的。我可以在我的测试项目上更新我的服务参考,但是我无法查看我的wcf服务公开的任何方法。

我的服务部署在Windows 2003上,我的测试应用也在XP上

2 个答案:

答案 0 :(得分:2)

答案在这里: WCF IIS server configuration

简而言之...... 问题在于WCF身份权限。用于承载WCF服务的应用程序池的标识必须对%WINDIR%\ temp文件夹具有完全NTFS权限。在C:\ Windows \ Temp上将该权限更改为我的身份(LOCAL SERVICE)后,我能够将服务引用添加到WCF服务。

答案 1 :(得分:0)

从错误消息中看起来好像找不到导入的xsd文件xsd2。

对服务的调用看起来像在端口80上,但是包含文件是从第8731点引用的。