加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows – 通信对象System.ServiceModel.Channels.ServiceChann

发布时间:2020-12-14 05:27:52 所属栏目:Windows 来源:网络整理
导读:The communication object,System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state. 当Windows应用程序尝试通过wsDualHttpBinding与作为Windows服务托管的WCF进行通信时,我收到此错误. WCF用于

The communication object,System.ServiceModel.Channels.ServiceChannel,
cannot be used for communication because it is in the Faulted state.

当Windows应用程序尝试通过wsDualHttpBinding与作为Windows服务托管的WCF进行通信时,我收到此错误. WCF用于通过串行端口与设备通信.用于经常通过WCF Windows服务发送命令的Windows应用程序.

这是堆栈跟踪:

stack trace: at
System.ServiceModel.Channels.CommunicationObject.ThrowIfDisposedOrNotOpen()
at System.ServiceModel.Channels.ServiceChannel.Call(String action,
Boolean oneway,ProxyOperationRuntime operation,Object[] ins,
Object[] outs,TimeSpan timeout) at
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
methodCall,ProxyOperationRuntime operation) at
System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message)

Exception rethrown at [0]: at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg,IMessage retMsg) at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData,Int32 type) at
GridSplitter.CommandServiceReference.ICommandService.SendToMultipleChannel(String[]
channel,Int32[][] locid,String cmd,Int32 cmdData) at
GridSplitter.CommandServiceReference.CommandServiceClient.SendToMultipleChannel(String[]
channel,Int32 cmdData) at
GridSplitter.MainWindow.bwChkAndSendRedeploy_DoWork(Object sender,
DoWorkEventArgs e) : 11/9/2012 11:05:58 AM

>我无法理解为什么服务会进入故障状态.
>我是否应该捕获此异常并执行一些补丁工作(如果推荐)?
> TCP绑定可以帮助我避免/删除此异常吗?

解决方法

您的问题是您的代码在服务调用生成故障后使用服务代理的实例(服务引用,由SvcUtil生成或直接从ChannelFactory创建).实现WCF的方式,一旦与该代理的调用发生错误,您就无法“重用”服务代理.

您需要在lines shown in this good post中为WCF特定要求编写适当的异常处理逻辑.无论您配置要使用的代理的实际绑定如何,都需要执行此操作.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读