开发者

Add service reference failed

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"/>
          </serviceCrede开发者_开发知识库ntials>
        </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>


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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜