I have problems with a WCF Service WsHttpBinding that I want to change to a NetTcpBinding.
Previously, I have set up the Service in my IIS7 local machine and it works with the WsHttpBinding.
The Proxy for this Service has a CustomBehavior which adds two message headers before sending the request message
When I change the binding to a NetTcpBinding I get the following Exception in my logs..
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)
This works fine with the wsHttpBinding, but when switching to NetTcpBinding it doesn’t.
What am I missing here?
Solved it myself.
This was my bad. A request was made to the WCF server BEFORE the actual request with parameters and Header, which forced the Service class to be instantiated. And in the constructor there was logic around the header data that was supposed to be there. I made a workaround for this