有没有办法向 EndpointAddress 添加标头?
我试过这个:
public static ChannelFactory<IClass> CreateFactory()
{
var authorization = new Authorization()
{
Key = "test"
};
AddressHeader header = AddressHeader.CreateAddressHeader(authorization);
var address = new EndpointAddress(ClientConfig.Endpoint, header);
var channel = new ChannelFactory<IClass>(address.ResolveBinding(), address);
return channel;
}
由于某种原因 new EndpointAddress
无法正常工作,因为它无法理解标题
('System.ServiceModel.EndpointAddress.EndpointAddress(System.Uri, System.ServiceModel.EndpointAddress)' 的最佳重载方法匹配有一些无效参数。)
没有标题一切正常。
我做错了什么?我无法理解...