【问题标题】:WCF-The document was understood, but it could not be processedWCF-文档被理解,但无法处理
【发布时间】:2009-06-12 16:39:46
【问题描述】:

我有一个部署在我的测试服务器上的 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 上

【问题讨论】:

  • 尝试 ping 192.1.1.1,如果你得到结果试试 telnet 192.1.1.1 8731 命令来检查你是否有与服务器的连接,可能是防火墙阻止了连接,你是在 vista 上部署服务器吗?

标签: wcf


【解决方案1】:

答案在这里: WCF IIS server configuration

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

【讨论】:

    【解决方案2】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-28
      相关资源
      最近更新 更多