WCF自定义Header

         MiscWebSrvcInfClient client = new MiscWebSrvcInfClient("MiscWSBeanPort", ConfigurationManager.AppSettings["WSMiscService"]);
                using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
                {
                    //添加header
                    foreach (var item in headers)
                    {
                        MessageHeader header = MessageHeader.CreateHeader(item.Key, string.Empty, item.Value);
                        OperationContext.Current.OutgoingMessageHeaders.Add(header);
                    }
                }

 

posted @ 2014-10-17 11:09 Ants 阅读(...) 评论(...) 编辑 收藏