添加服务引用失败
我使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为您还缺少元数据交换(mex)端点。尝试
在现有端点下方添加:。您应该能够打开网络浏览器来:
并查看实际情况显示 WSDL 文件。
I think you are also missing a Metadata Excahnge (mex) endpoint. Try adding:
underneath your existing endpoint. You should be able to open a web browser to:
and see the actual WSDL file displayed.
你在家里主持这个吗?该错误基本上表明您无法访问 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.
在本地电脑的主机文件(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)