WCF的service端的webconfig如下:

<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<services>
<service behaviorConfiguration="ServiceBehavior"
name="WcfServiceLibrary1.Service1">
<endpoint binding="wsHttpBinding"
bindingConfiguration=""
contract="WcfServiceLibrary1.IService1"/>
</service>
</services>
</system.serviceModel>
</configuration>

WCF 在VS中,添加服务引用,地址输入http://ip/Service.svc,点击前往,提示错误,内容如下:

下载“http://127.0.0.1:7293/WCFServerRefWCFLib.svc”时出错。
请求因 HTTP 状态 404 失败: Not Found。
元数据包含无法解析的引用:“http://127.0.0.1:7293/WCFServerRefWCFLib.svc”。
没有终结点在侦听可以接受消息的 http://127.0.0.1:7293/WCFServerRefWCFLib.svc。这通常是由于不正确的地址或者 SOAP 操作导致的。如果存在此情况,请参见 InnerException 以了解详细信息。
远程服务器返回错误: (404) 未找到。
如果该服务已在当前解决方案中定义,请尝试生成该解决方案,然后再次添加服务引用。

  

解决方法是:

在<system.serviceModel>节点中添加:

<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>

最后的配置是:

<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<services>
<service behaviorConfiguration="ServiceBehavior"
name="WcfServiceLibrary1.Service1">
<endpoint binding="wsHttpBinding"
bindingConfiguration=""
contract="WcfServiceLibrary1.IService1"/>
</service>
</services>
</system.serviceModel>
</configuration>

WCF 在VS中,添加服务引用,地址输入http://ip/Service.svc,点击前往,提示错误,内容如下:的更多相关文章

  1. 添加web引用和添加服务引用有什么区别?

    添加web引用和添加服务引用有什么区别,Add Service References 和 Add Web References 有啥区别?参考 http://social.microsoft.com/ ...

  2. (转)添加服务引用和添加Web引用对比

    在WindowsForm程序中添加服务引用和Web引用对比 为了验证书上有关Visual Studio 2010添加服务引用和Web引用的区别,进行实验. 一.建立一个Web服务程序项目新建项目,选择 ...

  3. 添加服务引用和添加Web引用对比

    原文:添加服务引用和添加Web引用对比 在WindowsForm程序中添加服务引用和Web引用对比 为了验证书上有关Visual Studio 2010添加服务引用和Web引用的区别,进行实验. 一. ...

  4. .net 添加web引用和添加服务引用有什么区别?

    添加web引用和添加服务引用有什么区别, Add Service References 和 Add Web References 有啥区别? 参考 http://social.microsoft.co ...

  5. WebService-.Net:添加web引用和添加服务引用有什么区别?

    ylbtech-WebService-.Net:添加web引用和添加服务引用有什么区别? 1.返回顶部 1. 添加web引用和添加服务引用有什么区别,Add Service References 和 ...

  6. WCF无.SVC文件服务激活,及不添加服务引用调用WCF

    一,新建WCF服务引用程序 1,删除.svc文件,全部删除. 2,新建 IService 类 namespace TestWcf { [ServiceContract] public interfac ...

  7. [问题]通过IIS宿主发布WCF服务,客户端添加服务引用出错的解决办法

    环境配置:Web服务器:Windows Server 2008,iis7.5,.net4.0客户端:XPsp3 vs2010 sp1 问题描述:1.确定WCF服务访问地址  http://servic ...

  8. WCF 添加服务引用 HTTP 请求已超过为 00:00:00 分配的超时。为此操作分配的时间可能是较长超时

    今天在用公司的笔记本引用WCF的时候,处于一直等待的过程,一直在下载信息,一直等了很长时间,弹出了一个消息 下载“http://ip:8085/xxxxx/xxxxx/mex/$metadata”时出 ...

  9. WCF分布式开发常见错误解决(1):An error occurred while attempting to find services at...添加服务引用出错

          WCF分布式开发常见错误解决(1):An error occurred while attempting to find services at...添加服务引用出错   当我们在客户端添 ...

随机推荐

  1. 在Ubuntu系统中解压rar和zip文件的方法

    大家在以前的windows系统中会存有很多rar和zip格式的压缩文件,Ubuntu系统默认情况下对这些文件的支持不是很好,如果直接用"归档管理器"打开会提示错误,因此今天跟大家分 ...

  2. HTTPClient模块的HttpGet和HttpPost

    HttpClient常用HttpGet和HttpPost这两个类,分别对应Get方式和Post方式. 无论是使用HttpGet,还是使用HttpPost,都必须通过如下3步来访问HTTP资源. 1.创 ...

  3. php学习-快速开发框架thinkphp-day1

    以下操作针对windows系统. 1.下载thinkphp3.23-all并解压 官方网站: http://www.thinkphp.cn/down.html 2.开发工具使用phpstorm htt ...

  4. android不依赖具体activity弹出Dialog对话框,即全局性对话框

    最近在DialogUtil类中声明了一个静态的弹出Dialog方法,弹出的Dialog也是静态的,并且只在第一次进行创建,由于Dialog弹出依附于Activity,所以就出现了问题. 即:第一次调用 ...

  5. UIView-4-EventForViews(在view上加入button时候的事件处理)

    #import "ViewController.h" @interface ViewController () @end @implementation ViewControlle ...

  6. java新手笔记29 读取文件

    1.读取文件 package com.yfs.javase; import java.io.FileInputStream; import java.io.FileReader; import jav ...

  7. css3学习笔记之渐变

    CSS3 线性渐变 语法 background: linear-gradient(direction, color-stop1, color-stop2, ...); 1 2 3 4 5 6 7 8 ...

  8. 查看Aix系统配置命令

    prtconf#topas http://baike.baidu.com/link?url=QruEnlfCqyoqQ565LicyKxIGMQYSkVesj6j9GzHWwzpDOagXtuprhT ...

  9. java-多线程-join函数

    join()>>不带参数 线程A调用线程B.join,意思就是线程A并入了线程B,当执行完线程B,再去执行线程A后续动作 join(int keepTims)>>带参数,与上面 ...

  10. 关于mysql group_concat 不能显示为空的列的其他信息

    今天做项目遇到一个问题,百度好久都没找到问题所在 是酱紫的,一张表 关联的表 然后我用sql语句查询 point.pid,point.pname,GROUP_CONCAT(downsite.pname ...