Is theres a client side event in wcf which get fired every time I create the object of my wcf client.
Actually I want to add outgoing header under wcf client
for now I am using code below in my client constructor under reference.cs
private void AddCustomHeaderUserInformation(OperationContextScope scope)
{
MessageHeader<int> mhg = new MessageHeader<int>(10);
MessageHeader untyped = mhg.GetUntypedHeader("slash", "slash");
OperationContext.Current.OutgoingMessageHeaders.Add(untyped);
}
There are two problems in using the above way
您应该看一下实现IClient MessageInspector的方法 -这允许您在较低级别插入服务模型层-您将在HeaderSendRequest中添加标头
我相信您可以在客户端上创建部分类,这样每次重新生成客户端代码时,行为就不会丢失。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.