什么是我的ASMX代理方法,这些额外的参数?我的、参数、方法、ASMX

由网友(浪子欧巴)分享简介:如果我加从.NET 1.1客户端的Web引用WCF服务,在客户端生成的代理方法包含后缀为指定为每个服务方法参数结束一个额外的参数,例如:If I add a web reference from a .NET 1.1 client to a WCF service, the proxy methods generat...

如果我加从.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.

有关附加阅读: http://msmvps.com/blogs/windsor/archive/2008/05/17/calling-wcf-services-from-net-1-1.aspx

阅读全文

相关推荐

最新文章