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

编程入门 行业动态 更新时间:2024-10-28 16:16:47
本文介绍了什么是我的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 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.

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

更多推荐

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

本文发布于:2023-11-09 05:10:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571467.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:参数   方法   ASMX

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!