0
votes

I'm trying to add a service reference in VS 2010 to a WCF Web Service I have on a Server 2008/IIS7 server. I put the service into an existing/working ASP.NET site. When I type in the url of the service, it comes up with the standard service screen, but when I try to add the reference to a new website project I'm developing, I get the following error.

The document at the url https://www.nameofsite.net/service.svc?wsdl 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 'https://www.nameofsite.net/service.svc?wsdl' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'. - Report from 'DISCO Document' is 'Discovery document at the URL https://www.nameofsite.net/Service.svc?disco could not be found.'. - The document format is not recognized. - 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: 'https://www.nameofsite.net/service.svc?wsdl'. There was no endpoint listening at https://www.nameofsite.net/service.svc?wsdl that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. The remote server returned an error: (404) Not Found. If the service is defined in the current solution, try building the solution and adding the service reference again.

I tried adding the mime type svc to IIS and that didn't work. I see that there's a lot of talk about soap 1.1 not communicating with soap 1.2 but I'm too new to this to even follow the instructions I've seen. Please help. Thanks.

1

1 Answers

1
votes

Is the service publishing its metadata? Check the httpsGetEnabled flag in the web.config file for the service:

<behaviors>
 <serviceBehaviors>
  <behavior name="NewBehavior">
    <serviceMetadata httpsGetEnabled="true" 
     httpsGetUrl="https://myComputerName/myEndpoint" />
  </behavior>
 </serviceBehaviors>
</behaviors>

For more info on these tags: ServiceMetaData

You may also need this endpoint configured in your web.config for the service:

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

Some more background: Web.Config

WSDL vs MEX