【发布时间】:2011-11-16 03:25:09
【问题描述】:
我是 wcf 的新手。我使用来自http://debugmode.net/2010/09/07/walkthrough-on-creating-wcf-4-0-service-and-hosting-in-iis-7-5/的教程在 iis 7.5 上创建并托管了简单的 wcf 服务
在我尝试使用此服务之前一切正常。当我尝试在我的客户端中添加服务引用时,它会出现以下错误
元数据包含无法解析的引用: 'http://localhost:4567/Service1.svc?wsdl'。 WSDL 文档包含 无法解析的链接。下载时出错 'http://localhost:4567/Service1.svc?xsd=xsd0'。底层证券 连接已关闭:接收时发生意外错误。 无法从传输连接读取数据:现有 连接被远程主机强行关闭。一个现有的 连接被远程主机强行关闭 元数据包含一个 无法解决的参考: 'http://localhost:4567/Service1.svc'。内容类型 应用程序/肥皂+xml; charset=utf-8 不受服务支持 http://localhost:4567/Service1.svc。客户端和服务绑定 可能不匹配。远程服务器返回错误:(415)不能 处理消息,因为内容类型 'application/soap+xml; charset=utf-8' 不是预期的类型 'text/xml;字符集=utf-8'。如果 该服务是在当前解决方案中定义的,请尝试构建 解决方案并再次添加服务引用。
我的服务的 web.config 包含
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
【问题讨论】:
-
客户端的wcf配置是什么?
-
客户端没有 wcf 配置。在客户端我尝试添加服务参考