添加服务引用失败

发布于 2024-12-04 12:23:55 字数 2604 浏览 4 评论 0原文

我使用iis 7.0托管我的wcf,网址是:

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

当我在vs2008中添加服务引用时,收到此错误:

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.

我的web.config是

<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>

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你的背包 2024-12-11 12:23:55

我认为您还缺少元数据交换(mex)端点。尝试

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

在现有端点下方添加:。您应该能够打开网络浏览器来:

https://193.91.152.191/CustPortal/CustomerService.svc?wsdl< /p>

并查看实际情况显示 WSDL 文件。

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.

祁梦 2024-12-11 12:23:55

你在家里主持这个吗?该错误基本上表明您无法访问 IP 地址,而我可以。这可能是路由器不支持“nat 环回”,因此您无法从网络内部访问外部 IP 地址。尝试通过本地 IP 地址添加引用。

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.

游魂 2024-12-11 12:23:55

在本地电脑的主机文件(C:\Windows\System32\drivers\etc\hosts)中添加Web服务的服务器主机名和IP地址

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文