Monday, January 18, 2010

Wow, so many posts in so few days.... someone should give me a medal.

After a plague of errors when trying to deploy some IIS7 hosted WCF services to a machine, and then using VS2008 from my local machine to create a ServiceReference, i thought i should list some of the issues and what fixed them. Any issues worth mentioning will get their own blog posts, so they will be short and sharp.

The document at the url http://192.168.0.999/ProjectServices/WebServices/MyWCFService.svc was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'DISCO Document' is 'There was an error downloading 'http://server2008.workflow.local/ProjectServices/WebServices/MyWCFService.svc?disco'.'.
- The request failed with HTTP status 502: Proxy Error ( Host was not found ).
- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.
- Report from 'http://192.168.0.999/ProjectServices/WebServices/MyWCFService.svc' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.
- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.
Metadata contains a reference that cannot be resolved: 'http://192.168.0.999/ProjectServices/WebServices/MyWCFService.svc'.
Content Type application/soap+xml; charset=utf-8 was not supported by service http://192.168.0.999/ProjectServices/WebServices/MyWCFService.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.


It turns out i was missing a mex entry from my service endpoint addresses in my web.config. As soon as i added it:

<services>
  <service behaviorConfiguration="BaseServiceBehavior" name="MyProject.Web.Services.MyWCFService">
    <endpoint binding="basicHttpBinding" bindingConfiguration="MyWCFService" contract="MyProject.Web.Services.IMyWCFService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>


the Add Service Reference started working. W00t.

*note for those who spotted the invalid url: as usual, identities have been changed to protect the innocent.

No comments: