【发布时间】:2011-12-03 18:56:55
【问题描述】:
我正在使用 webHttpBinding 来公开 wcf 服务并返回 JSON 格式,我想在标头中进行一些安全认证,例如:
CustomerServiceClient client = new CustomerServiceClient();
using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
{
MessageHeader header = MessageHeader.CreateHeader("username", "http://tempuri.org", "testuser");
OperationContext.Current.OutgoingMessageHeaders.Add(header);
}
但我收到此错误消息: 信封版本“EnvelopeNone (http://schemas.microsoft.com/ws/2005/05/envelope/none)”不支持添加邮件标头。
我google了很长时间,但没有结果。
谢谢。
【问题讨论】:
标签: wcf json soap soapheader