Add service reference failed

10,508

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.

Share:
10,508
GBK
Author by

GBK

Updated on June 04, 2022

Comments

  • GBK
    GBK about 2 years

    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>