WCF .svc Accessible Over HTTP But Accessing WSDL Causes "Connection Was Reset"
I have a WCF service which is hosted on IIS6 on a Win2003 SP2 machine. The WCF service is hosting correctly and is visible over HTTP giving the usual "To test this service, you will need to create a client and use it to call the service" message. However accessing the .svc?WSDL link causes the connection to be reset.
The server itself is returning a 200 in th开发者_开发百科e logs for the WSDL request, an example of which is shown here, the first call gets a connection reset, the second is a successful call for the .svc file.
2010-04-09 11:00:21 W3SVC6 MACHINENAME 10.79.42.115 GET /IntegrationService.svc wsdl 80 - 10.75.33.71 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+.NET+CLR+2.0.50727;+.NET+CLR+1.1.4322;+.NET+CLR+1.0.3705;+InfoPath.1;+.NET+CLR+3.0.04506.30;+MS-RTC+LM+8;+.NET+CLR+3.0.4506.2152;+.NET+CLR+3.5.30729;) - - devsitename.mydevdomain.com 200 0 0 0 696 3827
2010-04-09 11:04:10 W3SVC6 MACHINENAME 10.79.42.115 GET /IntegrationService.svc - 80 - 10.75.33.71 HTTP/1.1 Mozilla/5.0+(Windows;+U;+Windows+NT+5.1;+en-GB;+rv:1.9.1.9)+Gecko/20100315+Firefox/3.5.9+(.NET+CLR+3.5.30729) - - devsitename.mydevdomain.com 200 0 0 3144 457 265
My Web.Config looks like:
<system.serviceModel>
<serviceHostingEnvironment >
<baseAddressPrefixFilters>
<add prefix="http://devsitename.mydevdomain.com" />
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
<behaviors>
<serviceBehaviors>
<behavior name="My.Service.IntegrationServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="My.Service.IntegrationServiceBehavior" name="My.Service.IntegrationService">
<endpoint address="" binding="wsHttpBinding" contract="My.Service.Interfaces.IIntegrationService" bindingConfiguration="NoSecurityConfig" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="NoSecurityConfig">
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
I'm pretty much stumped by this one. It works fine through the local dev server in VS2008 but fails after deployment. For further information, the targeted machine does not have a firewall (it's on the internal network) and the logs show the site thinks it's fine with 200 OK responses. I've also tried updating the endpoint with the full URL to my service however it still makes no difference.
I have looked into some of the other options - creating a separate WSDL manually and exposing it through the metadata properties (really don't want to do that due to the maintenance issues).
If anyone can offer any thoughts on this or any other workarounds it would be greatly appreciated.
EDIT - Resolution: Thank you all for your help. With a combination of tracing and head-to-desk interfacing it was found that there was a logging application installed on the development server which was interfering with the response and forcing the stream to be closed after the initial receipt on the server. This came accross as a Connection Reset tot he client but a 200 for the server. Up-votes all round for your contributions and a beating with a rubber hose to the dev who surreptitiously installed the logger
Did you turn on tracing for the web service? This gives you detailed logs on what WCF is doing 'under the hood'.
Try to enable tracing for your service as described in this MSDN article, under the section called 'Recommended Settings for Deployment or Debugging'.
Once you have generated a trace file, you can view it using SvcTraceViewer.exe (usually located under something like C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin).
I agree - I'm stumped too. As far as I can tell, your WCF config looks just fine.
Things to try:
can you use the WCF Test Client to access your service using the
/IntegrationService.svc
address?can you use the test client to access your service using the
/IntegrationService.svc/mex
address?does accessing the WSDL work if you remove the
<serviceHostingEnvironment>
section from your config?
Can you try installing Fiddler and watching the HTTP traffic? Maybe that will shed some light on the problem.
Also check the Event Log on the deployed server to see if it has any errors when you try to access the WSDL.
精彩评论