刚刚将 WCF 项目部署到 IIS。
但是,当我尝试将服务引用添加到测试项目时,Visual Studio 会提供以下内容:
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://server1.local/WCFServices/serv1/serv1.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://server1.local/WCFServices/serv1/serv1.svc?wsdl'.
Content Type application/soap+xml; charset=utf-8 was not supported by service http://server1.local/WCFServices/serv1/serv1.svc?wsdl. 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.
所以有一个问题,我有点明白。服务的内容类型与客户的期望不匹配。
那么,我该如何解决呢?