当在客户端尝试一个简单的wcf服务调用时,如果我们使用如下所示的绑定,在服务端接收的字符串数据成员在开头的空格将被删除。
绑定:
<binding name="WSHttpBinding_CustomerService"
messageEncoding="Mtom" >
<security mode="None" />
</binding>
问题是:当使用这个绑定时,为什么服务端的前面空格被删除了?
然而,
,则删除
<security mode="None" />
并保留"Mtom",在服务端也不删除空格。
客户端
string customerName = " before and after ";
double totalAmount = customerAccountService.AddBalance(customerName , 100);
服务端--
the customerName becomes "before and after "
发布于 2011-05-20 21:12:23
微软已经确认这是一个错误:
http://connect.microsoft.com/wcf/feedback/details/619894/strings-stripped-of-leading-whitespace-when-using-mtom-message-encoding
https://stackoverflow.com/questions/6066932
复制相似问题