首页 新闻 会员 周边

WCF Ajax get方式可以获取,post 方式400错误

0
悬赏园豆:5 [已关闭问题] 关闭于 2013-02-02 11:28
<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错误

请问如何解决???????

Mr.Lin_♪的主页 Mr.Lin_♪ | 初学一级 | 园豆:3
提问于:2013-02-02 09:46
< >
分享
所有回答(2)
0

BodyStyle = WebMessageBodyStyle.Wrapped 设置一下就好了,找了很久,在msdn上找到。。。。

Mr.Lin_♪ | 园豆:3 (初学一级) | 2013-02-02 11:28
0

哥们你好,我今天也遇见你这个问题了,但是我按哥们你的设置不管用呀!!

monkey's | 园豆:204 (菜鸟二级) | 2013-12-23 18:38
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册