什么是我的ASMX代理方法,这些额外的参数? [英] What are these extra parameters in my ASMX Proxy Methods?
问题描述
如果我加从.NET 1.1客户端的Web引用WCF服务,在客户端生成的代理方法包含后缀为指定为每个服务方法参数结束一个额外的参数,例如:
If I add a web reference from a .NET 1.1 client to a WCF service, the proxy methods generated at the client contain an extra parameter ending with the suffix 'Specified' for each service method parameter, e.g.
[OperationContract]
string HelloWorld(string foo, int bar);
结果:
Service1.HelloWorld(string foo, bool fooSpecified, int bar, bool barSpecified);
我的服务参数不可选的,所以什么都在客户端,这些额外的参数,以及我怎样才能摆脱他们?
My service parameters aren't optional so what are these extra parameters at the client, and how can I get rid of them?
推荐答案
这是由于在WCF和ASMX Web服务使用的序列化机制的差异。 为了避免额外的PARAMS必须在指定的ServiceContract属性XmlSerializerFormat
This is due to a difference in the serialization mechanisms used in WCF and ASMX Web Services. To avoid extra params you must specify XmlSerializerFormat attribute on ServiceContract.
有关附加阅读: <一href="http://msmvps.com/blogs/windsor/archive/2008/05/17/calling-wcf-services-from-net-1-1.aspx">http://msmvps.com/blogs/windsor/archive/2008/05/17/calling-wcf-services-from-net-1-1.aspx
这篇关于什么是我的ASMX代理方法,这些额外的参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!