更新时间:2022-03-18 23:56:29
如果我理解正确,您想在请求的标题上设置用户名和密码.您可以通过将 WCF Extensibility – Message Inspectors
与 IClientMessageInspector.BeforeSendRequest
结合使用来实现.
If i understand correctly, you want to set username and password on the header of the requests. You can achieve by using WCF Extensibility – Message Inspectors
with IClientMessageInspector.BeforeSendRequest
.
创建一个实现 IClientMessageInspector
的类.在 BeforeSendRequest 方法中,将您的自定义标头添加到传出消息中.
Create a class that implements IClientMessageInspector
. In the BeforeSendRequest method, add your custom header to the outgoing message.