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);
                    }
                }
相關文章
相關標籤/搜索