Operation 'CreateProductCodeStock' of contract 'IChileService' specifies multiple request body parameters to be serialized without any wrapper elements.

At most one body parameter can be serialized without wrapper elements.

Either remove the extra body parameters or set the BodyStyle property on the WebGetAttribute/WebInvokeAttribute to Wrapped.

StackTrace:

at System.ServiceModel.Description.WebHttpBehavior.TryGetNonMessageParameterType(MessageDescription message, OperationDescription declaringOperation, Boolean isRequest, Type& type)
at System.ServiceModel.Description.WebHttpBehavior.ValidateBodyStyle(OperationDescription operation, Boolean request)
at System.ServiceModel.Description.WebHttpBehavior.<>c__DisplayClass70_1.<GetRequestClientFormatter>b__1()
at System.ServiceModel.Description.WebHttpBehavior.<>c__DisplayClass70_0.<GetRequestClientFormatter>b__0()
at System.ServiceModel.Description.WebHttpBehavior.HideReplyMessage(OperationDescription operationDescription, Effect effect)
at System.ServiceModel.Description.WebHttpBehavior.GetRequestClientFormatter(OperationDescription operationDescription, ServiceEndpoint endpoint)
at System.ServiceModel.Description.WebHttpBehavior.ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
at System.ServiceModel.Description.DispatcherBuilder.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime clientRuntime)
at System.ServiceModel.Description.DispatcherBuilder.BuildProxyBehavior(ServiceEndpoint serviceEndpoint, BindingParameterCollection& parameters)
at System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint, Boolean useActiveAutoClose)
at System.ServiceModel.ChannelFactory.CreateFactory()
at System.ServiceModel.ChannelFactory.OnOpening()
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ChannelFactory.EnsureOpened()
at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)
at System.ServiceModel.ChannelFactory`1.CreateChannel()
at WcfTest.Program.Main(String[] args) in D:\ChuckLu\Git\Edenred\WcfTest\WcfTest\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Source:

System.ServiceModel.Web

https://forums.asp.net/t/1749250.aspx?Exception+Operation+xx+of+contract+xx+specifies+multiple+request+body+parameters+to+be+serialized+without+any+wrapper+elements+

It seems that you have created Proxy code using Add Service Reference dialog in VS, Since WCF REST Service is not based on SOAP message, so Add Service Reference doesn't support WCF REST Service fully, and the proxy code is missing [WebInvoke] attribute. Try creating proxy code using Add Web Reference in VS. Please check this similar post.

stackoverflow.com/questions/4346554/wcf-service-proxy-throws-exception-when-more-than-one-parameter-is-used-in-oper

It seems you have created Proxy code using Add Service Reference dialog in VS.

VS ASR dialog doesn't support WCF REST fully, so, the proxy code is missing [WebInvoke] attribute.

Can you try adding [WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped)] attribute on operations in client proxy?

是因为缺少了attribute导致的。

解决方法,不使用添加ServiceReference的方式获取。直接调用Service的library

Exception: Operation xx of contract xx specifies multiple request body parameters to be serialized without any wrapper elements.的更多相关文章

  1. Linux内核中的Kconfig、xx.defconfig、xx.config、Makefile

    什么是Kconfig.xx.defconfig.xx.config.Makefile Kconfig: 一个文本形式的文件,其中主要作用是在内核配置时候,作为配置选项. xx.deconfig: Li ...

  2. (转)JVM内存分配 -Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m

    在linux环境下配置项目运行环境时,部署的人员都会分配一下内存,以保证程序正常的运行.其实在开发的时候(window系统),就已经涉及到内存分配了,只是这些参数有默认值,因此一直没有去重视它. 以M ...

  3. eclipse不能自动编译XX.java为XX.classs

    问题描述:eclipse不能自动编译XX.java为XX.classs 原因:今天下午写代码,因为需要引入jstl包,引入后发现原来项目中已经引入了,然后我又把包删除了,忘记删除java build ...

  4. myeclipse -vmargs -Xmx512m -XX:MaxPermSize=256m -XX:ReservedCodeCacheSize=64m

    myeclipse.ini把里面的参数为 -vmargs -Xmx512m -XX:MaxPermSize=256m -XX:ReservedCodeCacheSize=64m 以对于我而言,我只要把 ...

  5. jvm参数设置 -vmargs -Xms128M -Xmx512M -XX:PermSize=64M -XX:MaxPermSize=128M

    -vmargs -Xms128M -Xmx512M -XX:PermSize=64M -XX:MaxPermSize=128M 这里有几个问题: 1. 各个参数的含义什么? 2. 为什么有的机器我将- ...

  6. rpm卸载包遭遇 specifies multiple packages 错误

    使用 rpm删除软件时报错如下: [root@hostxxlidan]# rpm -qa |grep -i mysqlmysql-devel-5.0.95-5.el5_9mysql-devel-5.0 ...

  7. 小知识点 之 JVM -XX:MaxGCPauseMillis 与 -XX:GCTimeRatio

    写在前边 JVM调优更多是针对不同应用类型及目标进行的调整,往往有很大的实验成份,通过实验来针对当前应用设置相对合适的参数,提高应用程序的性能与稳定性 最近在复习JVM,Parallel Scaven ...

  8. 【异常及源码分析】org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping

    一.异常出现的场景 1)异常出现的SQL @Select("SELECT\n" + " id,discount_type ,min_charge, ${cardFee} ...

  9. -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m

    -Xms 最小堆的大小, 也就是当你的虚拟机启动后, 就会分配这么大的堆内存给你 -Xmx 是最大堆的大小 当最小堆占满后,会尝试进行GC,如果GC之后还不能得到足够的内存(GC未必会收集到所有当前可 ...

随机推荐

  1. NOIp2018模拟赛三十七

    奇怪的一场... 前两题都是全场题,C题明显不可做,我题目都没看懂...(STO lhx OTZ) 成绩:100+100+8=208 貌似十几个208的...A题暴力$O(nmc)$能过...暴力容斥 ...

  2. 51nod 1325 两棵树的问题(最大权闭合子图)

    首先如果点权全都为正,就可以直接选所有的点. 活在梦里.. 考虑枚举一个点\(i\),作为我们选择的集合中的一个点. 然后我们把另一个点\(j\)选入集合的时候必须把两棵树中\(i\)和\(j\)路径 ...

  3. javaweb集成swagger

    一.添加依赖 <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-sw ...

  4. svn 验证位置失败 Authorization failed

    进入svn的conf目录下 修改svnserve.conf [general] anon-access = none  #未登录用户不允许访问 auth-access = write  passwor ...

  5. linux 空间不够了 修改 /boot

    1>  查看空间多少:df -h2>  查看当期内核: uname -r3>  查找内核   rpm -qa | grep kernel4>  删除多余的内核 yum remo ...

  6. HTTP——学习笔记(3)

    HTTP报文:用于HTTP协议交互的信息,客户端的HTTP报文叫做 请求报文,响应端的叫做 响应报文 本质:是由多行(用CR+LF作换行符)数据构成的字符串文本 注:CR:回车,打印针回到行首   L ...

  7. Python学习第二天-编写三级菜单

    编写三级菜单:1. 运行程序输出第一级菜单2. 选择一级菜单某项,输出二级菜单,同理输出三级菜单3. 菜单数据保存在文件中4. 让用户选择是否要退出5. 有返回上一级菜单的功能 # Author: z ...

  8. Fragmen直接来回切换deno

    思路: 第一步.建立一个activity.用来管理fragment. 第二步'获取fragmentManger 和fragmentTraction. private FragmentManager f ...

  9. iOS AES的加密解密

    主要是要得到加密后的原来的字符创,MD5无法得到原有的,仅仅能用AES+base64 要用GTMBase64这个能够自己去下载, 主要看另外2个类文件. #import <Foundation/ ...

  10. 公布Qt Widgets桌面应用程序的方法

    公布Qt Widgets桌面应用程序的方法 Qt是一款优秀的跨平台开发框架,它能够在桌面.移动平台以及嵌入式平台上执行.眼下Qt 5介绍程序公布的文章帖子比較少.大家又很想要知道怎样公布Qt应用程序, ...