繁体   English   中英

将WCF绑定从wsHttp更改为netTcp

[英]Changing WCF binding from wsHttp to netTcp

我想将WCF服务WsHttpBinding更改为NetTcpBinding。 以前,我已经在IIS7本地计算机上设置了Service,并且可以与WsHttpBinding一起使用。

此服务的代理具有一个CustomBehavior,它在发送请求消息之前添加了两个消息头

当我将绑定更改为NetTcpBinding时,我的日志中出现以下异常。

 Exception: System.ServiceModel.ServiceActivationException: Service /ConsignmentService/Consignment.svc cannot be activated due to an exception during compilation. The exception message is: Exception has been thrown by the target of an invocation ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ServiceModel.MessageHeaderException: There is not a header with the name "ClientID" og namespace 'http://AmphoraExtension/Header' in the message.
   ved System.ServiceModel.Channels.MessageHeaders.GetHeader[T](String name, String ns, XmlObjectSerializer serializer)
   ved System.ServiceModel.Channels.MessageHeaders.GetHeader[T](String name, String ns)

wsHttpBinding可以正常工作,但是切换到NetTcpBinding时不能。 我在这里想念什么?

对于CustomBehaviour不太清楚,但是我遇到了完全相同的问题,即在netTcp下在IIS上运行WCF服务。 在这里查看我的问题:

IIS7.5上托管的WCF netTcpBinding停止工作

经过一番摆弄之后,我最终回答了我自己的问题,并发布了一份清单,以使IIS上运行netTcp服务。

我自己解决了。

这是我的坏事。 在带有参数和标头的实际请求之前,已向WCF服务器发出了一个请求,这迫使实例化Service类。 在构造函数中,应该在标头数据周围存在逻辑。 我为此做了一个解决方法

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM