开发者

Hosting WCF service on IIS7.5

i am new to wcf. i have created and hosted simple wcf service on iis 7.5 using tutorial from http://debugmode.net/2010/09/07/walkthrough-on-creating-wcf-4-0-service-and-hosting-in-iis-7-5/

all goes fine until i tried to consume this service. when i try to add service reference in my client it gives following error

Metadata contains a reference that cannot be resolved: 'http://localhost:4567/Service1.svc?wsdl'. The WSDL document contains links that could not be resolved. There was an error downloading 'http://localhost:4567/Service1.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/Service1.svc'. Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:4567/Service1.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'.开发者_JAVA技巧 If the service is defined in the current solution, try building the solution and adding the service reference again.

web.config of my service contains

<?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>


This is a generic error usually caused by an exception being thrown by the service. Unfortunately, since includeExceptionDetailInFaults is set to false in your config, you do not see any soap exception details on your client consuming the service.

First, set includeExceptionDetailInFaults = "true" in your development environment so you may see any additional exception details. Next, try to use a browser and navigate directly to http://localhost:4567/Service1.svc to see if the generic service page is displayed. Then try to navigate to http://localhost:4567/Service1.svc?wsdl to see if the WSDL is appropriately displayed. Any errors being thrown by the service should be thrown to the browser in both situations. Hopefully, this helps lead you to the root cause of your problem. Please post any additional information you find if you still cannot figure out the problem. Good luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜