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. BZOJ 4472 [Jsoi2015]salesman(树形DP)

    4472: [Jsoi2015]salesman Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 417  Solved: 192[Submit][St ...

  2. Python 线程高级篇 threading 模块的使用

    创建一个tread实例,给他传一个函数 #!/usr/bin/python import threading from time import * loops =[4,2] def loop (nlo ...

  3. mysql关联更新表

    UPDATE ecm_store s LEFT JOIN (SELECT store_id, COUNT(goods_id) AS goods_count FROM ecm_goods GROUP B ...

  4. JAVA SSL

    http://docs.oracle.com/javase/1.5.0/docs/guide/security/jsse/JSSERefGuide.html#InstallationAndCustom ...

  5. 不安装Oracle客户端,用plsql连接远程Oracle数据库(绝对解决你的问题)

    1,首先准备下载两个软件,一个是instantclient.zip,另一个是plsql安装包.但是得确定您的电脑是32位还是64位,我这边提供了32位和64位的供您下载: 百度网盘:https://p ...

  6. 使用sh运行bash脚本的奇怪问题

    在同一个文件夹下有两个脚本.a.sh和b.sh,脚本内容例如以下: a.sh: echo "test for a" source b.sh b.sh: echo "tes ...

  7. cocos2dx 触摸钢琴

    1.触摸钢琴项目描写叙述 1.1触摸钢琴功能描写叙述 实现手指点按琴键发出相应的音调,按下位置出现星云的粒子特效,滚动实现移动到别的琴键的位置,按下安卓返回键运行关闭. 1.2触摸钢琴所需技术 粒子特 ...

  8. Android触碰事件

    OnTouchListener使用 public class ViewActivity extends Activity implements View.OnTouchListener { @Over ...

  9. RvmTranslator7.0-OBJ

    RvmTranslator7.0-OBJ eryar@163.com RvmTranslator can translate the RVM file exported by AVEVA Plant( ...

  10. App server 与 Web server之间的区别

    原文: http://www.javaworld.com/javaqa/2002-08/01-qa-0823-appvswebserver.html 简单来说,web服务器提供页面给浏览器,而app服 ...