到目前为止,我正在使用手动方式进行代理,这就是我处理标头的方式: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 回答
- 1 回答
- 0 关注
- 178 浏览
添加回答
举报
0/150
提交
取消