我有一个 WCF Web 服务,我正在尝试将其发布到 IIS。我可以很好地查看 wsdl,但无法通过“添加服务引用”菜单在 Visual Studio 2010 中添加服务。我收到以下错误:
Metadata contains a reference that cannot be resolved: 'http://localhost:4567/Service.svc?wsdl'.
The WSDL document contains links that could not be resolved.
There was an error downloading 'http://localhost:4567/Service.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://localhost:4567/Service.svc'.
Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:4567/Service.svc. 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.
我在本地工作得很好,但如果发布到 IIS 就不行。
有谁知道是什么导致了这个问题?这是我的 web.config,我是 WCF 的新手,所以可能错过了一些东西,谢谢:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<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"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<connectionStrings>
</connectionStrings>
</configuration>