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 狀態時才可以設定這個屬性,因為這是唯一同時處於可變動且尚未處置的狀態。