我正在尝试在windows服务中托管的wcf和我的服务gui之间进行通信。问题是当我试图执行我得到的operationcontract方法时
“频道调度员
'net.tcp://localhost:7771/myservice'
“合同”是指
无法打开其ichannellistener。“
我的app.conf看起来是这样的:
<configuration>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="netTcpBinding">
<security>
<transport protectionLevel="EncryptAndSign" />
</security>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:7772/MyService" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MyServiceBehavior"
name="MyService.Service">
<endpoint address="net.tcp://localhost:7771/MyService" binding="netTcpBinding"
bindingConfiguration="netTcpBinding" name="netTcp" contract="MyService.IContract" />
</service>
</services>
</system.serviceModel>
端口7771正在侦听(使用netstat检查),svcutil能够为我生成配置。
如有任何建议,将不胜感激。
异常的堆栈跟踪
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
有一个内部exeption(但不在exeption.innerexeption下,而是在exeption.detail.innerexeption-toString()方法下没有显示)
已存在对uri“net.tcp://localhost:7771/myservice”的注册。
但是我的服务只在app.config文件中指定了这个uri。在整个解决方案中,这个uri只在服务器上运行一次,在客户端运行一次。
最佳答案
对于这种类型的异常,内部异常具有诊断问题的有用信息。这是一个相当普遍的错误,可能是由一堆不同的事情引起的。