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

最新文章

  1. 什么是jquery $ jQuery对象和DOM对象 和一些选择器
  2. JAVA中static关键字
  3. Spark SQL利器:cacheTable/uncacheTable
  4. nodejs 实现简单的文件上传功能
  5. Bzoj2946:[POI2000] 最长公共子串
  6. Java与.net的选择和比较
  7. RecyclerView嵌套ScrollView导致RecyclerView内容显示不全
  8. Vue.js学习过程
  9. 关于jqGrid组件表格无法自适应宽度问题
  10. MySQL中间件之ProxySQL(5):线程、线程池、连接池
  11. 爬虫——cookies池的搭建
  12. centos6.8 yum安装mysql 5.6 (完整)
  13. 《Lua程序设计》第7章 迭代器与泛型for 学习笔记
  14. vim---打造Python IDE
  15. 访问一个HTTPS的网站的大致流程
  16. C# 之文件拖拽和pixturBox缩放与拖拽
  17. Selenium2+python自动化-操作浏览器基本方法
  18. CentOS修改时区、日期、时间
  19. 我的BootStrap学习笔记
  20. Documentation/ABI/testing/sysfs-block.txt

热门文章

  1. 2015,鬼王Xun和GGL比赛,带给我们无尽的欢乐
  2. PID三种参数的理解
  3. 编写使用systemctl启动服务脚本
  4. 笔记本win2008 r2的hyper-v安装centos
  5. ORA-06553:PLS-306:wrong number or types of arguments in call to &amp;#39;&amp;#39;
  6. 移植u-boot-2014.4到S5PV210/TQ210(完整)
  7. java webproject中logback换配置文件的路径
  8. wireshark界面调整成英文的
  9. Android Shape使用
  10. ARM嵌入式复习