none
部署在其它机器上的WCF服务为什么引用不了??? RRS feed

  • 问题

  • 情况是这样:我在A机器上开发了一个WCF服务,然后部署在A机器上的IIS中,能成功通过浏览器访问服务,也能在vs2010中添加引用。可是我把该服务部署到B机器上时,虽然能通过浏览器访问服务,然而想用VS2010引用该服务时,搜索不到服务,错误提示如下:

     

    The document at the url http://10.103.118.6/ was not recognized as a known document type.
    The error message from each known type may help you fix the problem:
    - Report from 'http://10.103.118.6/' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.
    - Report from 'DISCO Document' is 'There was an error downloading 'http://csfw/bsyj.Add.svc?disco'.'.
      - The remote name could not be resolved: 'csfw'
    - Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.
    - Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.
    Metadata contains a reference that cannot be resolved: 'http://10.103.118.6/'.
    Metadata contains a reference that cannot be resolved: 'http://10.103.118.6/'.
    If the service is defined in the current solution, try building the solution and adding the service reference again.

     

    请问各位知道是什么原因吗?谢谢

    2010年6月2日 2:23

答案

  • 检查一下你服务的地址。

    你在B机器上部署服务后,浏览器查看WSDL的地址是什么?'http://csfw/bsyj.Add.svc地址对吗?

    把这个地址里的localhost换为B机器的IP地址即可。

    然后再添加服务引用,另外跨机器访问,记得打开防火墙端口,


    Frank Xu Lei--谦卑若愚,好学若饥
    专注于.NET平台下分布式应用系统开发和企业应用系统集成
    Focus on Distributed Applications Development and EAI based on .NET
     

    老徐的网站】:http://www.frankxulei.com/

    老徐的博客】:http://www.cnblogs.com/frank_xl/

    【WCF中文技术论坛】:微软WCF中文技术论坛
    【WCF英文技术论坛】:微软WCF英文技术论坛

    • 已标记为答案 Mog Liang 2010年6月8日 9:41
    2010年6月2日 14:13
    版主