您好我已经在服务器机器上部署了 WCF Web 服务。我可以在浏览器中浏览它。但是当我要将其服务引用添加到开发机器上的 Web 应用程序时,我收到以下详细错误:
元数据包含无法解析的引用:“http://ServerMachineName:500/ITCAMSWebService_deploy/Services/Authentication.svc?wsdl”。WSDL 文档包含无法解析的链接。下载“http://ServerMachineName:500/ITCAMSWebService_deploy/Services/Authentication.svc?xsd=xsd0”时出错。底层连接已关闭:接收时发生意外错误。无法从传输连接读取数据:现有连接被远程主机强行关闭。远程主机强制关闭现有连接 元数据包含无法解析的引用:“http://ServerMachineName:500/ITCAMSWebService_deploy/Services/Authentication.svc”。内容类型应用程序/soap+xml;
http://ServerMachineName:500/ITCAMSWebService_deploy/Services/Authentication.svc
. 客户端和服务绑定可能不匹配。远程服务器返回错误:(415)无法处理消息,因为内容类型'application/soap+xml; charset=utf-8' 不是预期的类型 'text/xml; charset=utf-8'.. 如果在当前解决方案中定义了服务,请尝试构建解决方案并再次添加服务引用。
服务器的 Web.config 中生成的服务模型部分如下:
<system.serviceModel>
<services>
<service name="Authentication" behaviorConfiguration="Behavior_Authentication">
<host>
<baseAddresses>
<add baseAddress="http://ServerMachineName:500/ITCAMSWebService_deploy/Services/Authentication.svc"></add>
</baseAddresses>
</host>
<endpoint address="" contract="IAuthentication" binding="basicHttpBinding" bindingConfiguration="ITCAMSWebService.IAuthentication" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483646" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
</system.serviceModel>