2011-12-27 58 views

回答

0

如果您想更改消息编码,您需要定义一个绑定配置 - 选择您正在使用的绑定,并定义您想要的,例如, MTOM编码:

<bindings> 
    <wsHttpBinding> 
    <binding name="MTOM" messageEncoding="Mtom" /> 
    </wsHttpBinding> 
</bindings> 

然后,在你的终端服务器和客户端(他们必须排队定义同样的事情!),你需要使用绑定配置:

<service name="test" > 
    <endpoint name="test" 
     address="" 
     binding="wsHttpBinding" 
     bindingConfiguration="MTOM" 
     contract="IYourService" /> 
    </service> 

您必须在客户端和服务器上设置此项 - 您需要提前确定是否使用MTOM编码(而不是常规文本编码)。

+0

谢谢,但我有一个不同的查询。在消息被实际解码之前,我可以知道来自服务器的响应的编码,以便我可以在客户端使用与服务器端的响应相同的正确终端。 – 2011-12-27 18:31:13

+0

@klra:我试图解释:** no **你不能这样做 - 当你配置服务什么编码将用于什么端点时,你需要提前决定**。你不能“神奇地”检测到每条消息 - 它必须被决定和配置。 – 2011-12-27 19:44:20

+0

好的,我们可以在客户端或服务器端的任何级别上至少确定传入消息的消息编码吗? – 2011-12-28 03:23:11