405 Method Not Allowed Error in WCF

前端 未结 2 508
忘了有多久
忘了有多久 2020-12-11 22:17

Can someone spot the problem with this implementation? I can open it up in the browser and it works, but a call from client side (using both jquery and asp.net ajax fails)

2条回答
  •  忘掉有多难
    2020-12-11 22:38

    for method not allowed error, all you need to check is to make sure that your http web call /request is the same as the one specified in [WebInvoke...] in the service

      $.ajax({
                    type: "POST",.....});
    

    SHOULD BE IDENTICAL TO WHAT WAS SPECIFIED IN THE SERVICE INTERFACE (UNDER "[Operation Contract]")

     [WebInvoke(Method = "POST",BodyStyle = WebMessageBodyStyle.Wrapped,ResponseFormat = WebMessageFormat.Json)]
    

提交回复
热议问题