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  阅读(835)  评论(0编辑  收藏  举报