<webHttpBinding> <binding name="webBinding" maxReceivedMessageSize="2147483647" crossDomainScriptAccessEnabled="true" > <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/> </binding> </webHttpBinding> <behavior name="AjaxBehavior"> <webHttp/> </behavior> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" > <serviceActivations> <add service="Touch_Dinner.Service.CityService" relativeAddress="~/CityService.svc" factory="System.ServiceModel.Activation.WebServiceHostFactory"/> </serviceActivations> </serviceHostingEnvironment>
上面配置主要允许了ajax方式访问,get没问题,请求路径正确,没有跨域的请求
服务[WebInvoke(Method="POST",RequestFormat=WebMessageFormat.Json)]
请求显示400错误
请问如何解决???????
BodyStyle = WebMessageBodyStyle.Wrapped 设置一下就好了,找了很久,在msdn上找到。。。。
哥们你好,我今天也遇见你这个问题了,但是我按哥们你的设置不管用呀!!