到目前為止,我正在使用手動方式進行代理,這就是我處理標頭的方式:public abstract class UserClientBase<T> : ClientBase<T> where T : class{ public UserClientBase() { string userName = Thread.CurrentPrincipal.Identity.Name; MessageHeader<string> header = new MessageHeader<string>(userName); OperationContextScope contextScope = new OperationContextScope(InnerChannel); OperationContext.Current.OutgoingMessageHeaders.Add( header.GetUntypedHeader("String", "System")); }}public class FooClient : UserClientBase<IFooService>, IFooService{ public Foo Test() { return Channel.Test(); }}我的問題是..如何使用自動生成的代理來做到這一點?, 像這樣:using (FooServiceClient client = new FooServiceClient()){ return await client.Test();}
- 1 回答
- 0 關注
- 193 瀏覽
添加回答
舉報
0/150
提交
取消