WCF的问题

luwenshuo 2007-10-14 08:16:45
请问如果用WCF的host用的是HTTP协议,那么用这段命令就可以生成客户端类
svcutil.exe http://localhost:8888/EmployersReward?wsdl

但是如果用的是tcp协议的话如何试用svcutil来生成客户端类呢?我尝试使用这个的命令
svcutil.exe net.tcp://localhost:9999/EmployersReward
但是却报下面这样的错,请问应该怎样做?


WS-Metadata Exchange Error
URI: net.tcp://localhost:9999/EmployersReward

元数据包含无法解析的引用:“net.tcp://localhost:9999/EmployersReward”。

套接字连接已中止。这可能是由于处理消息时出错或远程主机超过接收超时或者潜在的
网络资源问题导致的。本地套接字超时是“00:04:59.9218750”。

远程主机强迫关闭了一个现有的连接。
...全文
698 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
ljmemail 2009-11-11
  • 打赏
  • 举报
回复
我也碰到此类问题,有解决吗?
knowledge_Is_Life 2008-05-01
  • 打赏
  • 举报
回复
有点难度哦
sgp1201 2007-12-14
  • 打赏
  • 举报
回复
svcutil.exe /language:cs /config:app.config http://localhost:8888/yourService
sgp1201 2007-12-14
  • 打赏
  • 举报
回复
搞定了没有,我是用netTcpBinding 我的security配置成windows 提示的是我的凭证不对,换成none后出问题,google到你的贴子,搞定了分享呀,兄弟!
gyc 2007-11-19
  • 打赏
  • 举报
回复
只有在配置了 mex*Binding 和serviceMetadata 服务行为True时才可以获取元数据

<configuration>
<system.serviceModel>
<services>
<service
name="Microsoft.ServiceModel.Samples.CalculatorService"
behaviorConfiguration="CalculatorServiceBehavior">
<!-- This endpoint is exposed at the base address provided by the host: http://localhost/servicemodelsamples/service.svc -->
<endpoint address=""
binding="wsHttpBinding"
contract="Microsoft.ServiceModel.Samples.ICalculator" />
<!-- the mex endpoint is exposed at http://localhost/servicemodelsamples/service.svc/mex
To expose the IMetadataExchange contract, you
must enable the serviceMetadata behavior as demonstrated below
必须有这个节点能请求 -->
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>

<!--For debugging purposes set the includeExceptionDetailInFaults attribute to true-->
<behaviors>
<serviceBehaviors>
<behavior name="CalculatorServiceBehavior">
<!-- The serviceMetadata behavior publishes metadata through
the IMetadataExchange contract. When this behavior is
present, you can expose this contract through an endpoint
as shown above. Setting httpGetEnabled to true publishes
the service's WSDL at the <baseaddress>?wsdl
eg. http://localhost/servicemodelsamples/service.svc?wsdl
如果这个为false话,会直接拒绝请求 -->
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>

</system.serviceModel>

</configuration>
diablo1003 2007-11-13
  • 打赏
  • 举报
回复
偶的配置文件是这样的
<appSettings>
<add key="Address" value="net.tcp://localhost:2500/WcfService"/>
<add key="DefaultCntString" value="Initial Catalog=JHR;Server=yjw;Persist Security Info=False;User ID=sa;Password=redmaple;"
/>
<add key="MaxReceivedMessageSize" value="2000000"/>
<add key="MaxBufferSize" value="2000000"/>
<add key="MaxConnections" value="10"/>
</appSettings>

生成的话,那个命令应该怎么写的呢?谢谢
guoweijun394 2007-11-13
  • 打赏
  • 举报
回复
WCF就是一个ABC
即:address binding contract

配置文件server 有一个 , client有一个
给你个网 http://www.rainsts.net/default.asp?cat=21 说的很清楚

Merkava2007 2007-11-13
  • 打赏
  • 举报
回复
哪位大侠能把WCF里的配置文件给说说清楚的 ?
levinknight 2007-11-12
  • 打赏
  • 举报
回复
把你的配置文件show一下
VirtualDesktop 2007-11-11
  • 打赏
  • 举报
回复
svcutil "exe路径"
svcutil *.wsdl *.xsd /a /language:C# /out:MyProxy.cs /config:app.config
diablo1003 2007-11-08
  • 打赏
  • 举报
回复
支持啊,偶也遇到这个问题,楼主解决了么?解决的话告诉一声哈,3Q
luwenshuo 2007-10-14
  • 打赏
  • 举报
回复
没人吗?
luwenshuo 2007-10-14
  • 打赏
  • 举报
回复
up up

13,347

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET技术前瞻
社区管理员
  • .NET技术前瞻社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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