Expose schema as WCF service

Today we ran into a small problem while exposing a schema as a WCF service. We could open the service in our browser, we would see the service.

Webservice runningHowever when trying to add the service as a reference in Visual Studio we got the following error:
The document at the url http://biztalk.customer.com/RetreiveContact/RetreiveContact.svc was not recognized as a known document type.
The error message from each known type may help you fix the problem:
– Report from ‘XML Schema’ is ‘The document format is not recognized (the content type is ‘text/html; charset=UTF-8′).’.
– Report from ‘http://biztalk.customer.com/RetreiveContact/RetreiveContact.svc’ is ‘The document format is not recognized (the content type is ‘text/html; charset=UTF-8′).’.
– Report from ‘DISCO Document’ is ‘There was an error dowcomoading ‘http://biztalk01/RetreiveContact/RetreiveContact.svc?disco’.’.
– The remote name could not be resolved: ‘biztalk01’
– Report from ‘WSDL Document’ 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://biztalk.customer.com/RetreiveContact/RetreiveContact.svc’.
Metadata contains a reference that cannot be resolved: ‘http://biztalk.customer.com/RetreiveContact/RetreiveContact.svc’.
If the service is defined in the current solution, try building the solution and adding the service reference again.
Now the trick is in this part: – The remote name could not be resolved: ‘biztalk01’. We are contacting the machine from the outside, but our service points to an internal server. To change this, I went into the IIS manager, opened Sites -> BizTalk Site, and opened the bindings. Here I edit the http binding, and changed the hostname to biztalk.customer.com, and after restarting the website we could now succesfully import the service in Visual Studio.

Edit bindings

1 thought on “Expose schema as WCF service

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.