WCF的问题

烈火蜓蜻 2009-06-23 04:05:54
当我的WCF服务端用netTcpBinding绑定的时候,客户端怎么样才能添加这个服务的引用?

服务品端的配置是这样的

<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service name="Microsoft.ADC.Framework.ExceptionService.ExceptionProcess">
<endpoint address="net.tcp://127.0.0.1:8001/ExceptionService"
binding="netTcpBinding"
contract="Microsoft.ADC.Framework.ExceptionService.Contracts.IExceptionService" />
</service>
</services>
</system.serviceModel>
</configuration>


我添加服务引用的时候,输入 tcp://127.0.0.1:8001/ExceptionService 地址时,会提示出错:

MetadataExchangeClient 实例无法初始化,因为方案“tcp”没有可用的绑定。可以在构造函数中提供绑定或指定 configurationName。
参数名: scheme
如果该服务已在当前解决方案中定义,请尝试生成该解决方案,然后再次添加服务引用。

服务端已确定启动了,已经在监听端口了
...全文
96 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
acqy 2009-06-29
  • 打赏
  • 举报
回复
这样:
你用VS创建一个WcfService,让他自动生成,在生成的appconfig里有定义metaexchange endpoint和behavior的代码,copy+paste到你的appconfig里的相应位置即可。
cheng_feng001 2009-06-26
  • 打赏
  • 举报
回复
你看看MSDN上的简单实例,估计就能明白了。
love_幸运儿 2009-06-26
  • 打赏
  • 举报
回复
检查服务端与客户端......
wangruqing 2009-06-26
  • 打赏
  • 举报
回复
这个不会
等答案,学习
acqy 2009-06-26
  • 打赏
  • 举报
回复
你想通过客户端去发现服务,比如使用svcutil.exe生成client proxy,就需要在服务端暴露MetaExchangeEndPoint。
烈火蜓蜻 2009-06-26
  • 打赏
  • 举报
回复
其实就是我的服务就定义一个TCP绑定,没有其它的绑定的,我现在想在客户发现这个服务,弄不了
wwb82954323 2009-06-24
  • 打赏
  • 举报
回复
楼主说添加服务引用是啥意思?客户端调用WCF的服务,也是通过配置文件来的吧?

服务器端:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="CalculatorBehavior">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="CalculatorBehavior" name="WWB.SessionfulCalculator.Service.CalculatorService">
<endpoint address="" binding="wsHttpBinding" contract="WWB.SessionfulCalculator.Contract.ICalculator"/>
<host>
<baseAddresses >
<add baseAddress="http://localhost:9999/SessionfulCalculator"/>
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
客户端:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="calculatorEndpointBehavior">
<clientVia viaUri="http://localhost:8080/SessionfulCalculator"/>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="http://localhost:9999/SessionfulCalculator" behaviorConfiguration="calculatorEndpointBehavior" binding="wsHttpBinding" contract="WWB.SessionfulCalculator.Contract.ICalculator" name="httpEndPoint"></endpoint>
</client>
</system.serviceModel>
</configuration>

我的这样配好后,客户端就可以调用了
lyre129 2009-06-24
  • 打赏
  • 举报
回复
也不会,期待解答。
烈火蜓蜻 2009-06-24
  • 打赏
  • 举报
回复
顶一个
chengqscjh 2009-06-24
  • 打赏
  • 举报
回复
MetadataExchangeClient 实例无法初始化,因为方案“tcp”没有可用的绑定。可以在构造函数中提供绑定或指定 configurationName。
参数名: scheme
如果该服务已在当前解决方案中定义,请尝试生成该解决方案,然后再次添加服务引用。
---------------------------------------------------------------------------------
tcp没有可用的绑定,重点检查下你的配置文件,在进行添加服务引用的时候就报错了,说明你服务端的程序就说明问题了。
jueyingfd 2009-06-24
  • 打赏
  • 举报
回复
等待高手!!!!!!!!!!!!!!!!!!!
ximi82878 2009-06-24
  • 打赏
  • 举报
回复
别的忙帮补上,只能纯粹的帮忙顶

110,570

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧