2

I hosted my wcf using iis 7.0, the url is:

https://example.com/CustPortal/CustomerService.svc

when i add service reference in vs2008, got this errors:

The document at the url https://example.com/CustPortal/CustomerService.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 'https://el-cust-port01/CustPortal/CustomerService.svc?disco'.'.
  - Unable to connect to the remote server
  - No connection could be made because the target machine actively refused it 59.37.71.86:443
- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.
- Report from 'https://193.91.152.191/CustPortal/CustomerService.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: 'https://193.91.152.191/CustPortal/CustomerService.svc'.
Metadata contains a reference that cannot be resolved: 'https://193.91.152.191/CustPortal/CustomerService.svc'.
If the service is defined in the current solution, try building the solution and adding the service reference again.

My web.config is

<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="metadataBehavior">
          <serviceMetadata httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceCredentials>
            <serviceCertificate storeName="My"  x509FindType="FindBySubjectName" findValue="TESTCERT" storeLocation="LocalMachine"/>
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="metadataBehavior" name="EV.Services.CustomerService">
        <endpoint binding="wsHttpBinding" bindingConfiguration="wsHttpBindingConfig" contract="EV.Contracts.ICustomer" />
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="wsHttpBindingConfig">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
  </system.serviceModel>

3 Answers 3

4

I think you are also missing a Metadata Excahnge (mex) endpoint. Try adding:

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

underneath your existing endpoint. You should be able to open a web browser to:

https://193.91.152.191/CustPortal/CustomerService.svc?wsdl

and see the actual WSDL file displayed.

Sign up to request clarification or add additional context in comments.

3 Comments

hi rally, you are super man, it works for me used your code. but i got another issue when i invoke the method: Could not establish trust relationship for the SSL/TLS secure channel with authority '193.91.152.191'.
i searched it and got a solution using below code: ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(OnValidationCallback); public static bool OnValidationCallback(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors errors) { return true; }
You can find a list of all the changes need to make a wcf service work over https here. It looks like that one was the only one you were missing. codeproject.com/Articles/36705/…
0

Are you hosting that at home? The error basically says that you can't reach the IP address, which I can. That might be a router not supporting "nat loopback", so you can't access your external IP address from inside your network. Try adding the reference by its local IP address.

1 Comment

no, it's a public ip, you can access via 193.91.152.191/CustPortal/CustomerService.svc?wsdl, but cannot add service reference in vs2008.
0

add the server's hostname and IP address of the webservice in your local pc's hosts file (C:\Windows\System32\drivers\etc\hosts)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.