WCF服务的WSDL中显示的是电脑名字,不是网站IP

 如下

<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://win-od7k4111cv7:8883/WCFService/SystemSettingService.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://win-od7k4111cv7:8883/WCFService/SystemSettingService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>

在发布到互联网后通常会出现wsdl里的xml schema 是无法下载的,因为schem的网址是局域网地址或者localhost,

如果你把互联网地址直接加到endpoint或者申明互联网域名为baseAddress ,会出现找不到的错误消息,为什么了?

例如你的WCF网址是 abc.com/service/file.svc, 你把endpoint的address设置为 abc.com/service/file.svc, 或者baseAddress设置为 abc.com/service,会出现找不到的错误消息。

 
解决:在服务器IIS的绑定中把主机头也设成IP或都域名就行了
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://91.123.71.211:8883/WCFService/SystemSettingService.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
 
posted on 2015-07-01 09:22  zsfwh  阅读(401)  评论(0)    收藏  举报