簡體   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