ChannelDispatcher.MessageVersion 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置使用的或预期的 SOAP 消息和 WS-Addressing 版本。
public:
property System::ServiceModel::Channels::MessageVersion ^ MessageVersion { System::ServiceModel::Channels::MessageVersion ^ get(); void set(System::ServiceModel::Channels::MessageVersion ^ value); };
public System.ServiceModel.Channels.MessageVersion MessageVersion { get; set; }
member this.MessageVersion : System.ServiceModel.Channels.MessageVersion with get, set
Public Property MessageVersion As MessageVersion
属性值
使用的或预期的 MessageVersion。
例外
通信对象处于 Faulted 状态。
示例
Uri baseAddress = new Uri("http://localhost:8001/Simple");
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);
serviceHost.AddServiceEndpoint(
typeof(ICalculator),
new WSHttpBinding(),
"CalculatorServiceObject");
serviceHost.Open();
IChannelListener icl = serviceHost.ChannelDispatchers[0].Listener;
ChannelDispatcher dispatcher = new ChannelDispatcher(icl);
dispatcher.MessageVersion = MessageVersion.Default;
Dim baseAddress As New Uri("http://localhost:8001/Simple")
Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)
serviceHost.AddServiceEndpoint(GetType(ICalculator), New WSHttpBinding(), "CalculatorServiceObject")
serviceHost.Open()
Dim icl As IChannelListener = serviceHost.ChannelDispatchers(0).Listener
Dim dispatcher As New ChannelDispatcher(icl)
dispatcher.MessageVersion = MessageVersion.Default
注解
指定与消息及其交换相关联的 SOAP 和 WS-Addressing 的版本。
只有当 ChannelDispatcher 的实例处于 Created 状态时才可以设置此属性,因为该状态是唯一一个可变且不被释放的状态。