这个问题已经在许多帖子中以类似的方式提出,但没有可行的解决方案。
我的服务端点ManagerDiscountService
如下所示:
[ServiceBehavior]
[ServiceContract(Namespace = "Cart")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class ManagerDiscountService : CartService
[OperationContract]
// also tried [WebInvoke(RequestFormat=WebMessageFormat.Json)]
// also tried [WebInvoke(RequestFormat=WebMessageFormat.Json, Method="POST")]
public MyObject ToggleMode(string userId, string pwd, string domain)
网络配置:
<service name="Cart.ManagerDiscountService">
<endpoint address="" behaviorConfiguration="Item.ItemAspNetAjaxBehavior"
binding="webHttpBinding" bindingConfiguration="wsSecureHttp"
contract="Cart.ManagerDiscountService" />
</service>
<!-- tried adding a similar wsHttp binding since the POST is not SSL, no luck -->
我正在尝试将userId
,pwd
和发布domain
到这个端点,但我看到的只有 500 个。为什么这种发布方法不起作用?当我在 Chrome 中调试时,error
总是下一次执行$.ajax
:
params = { "userId": "user", "pwd": "password", "domain": "mydomain" };
$.ajax({
type: "POST",
url: "/Ajax/Cart/ManagerDiscountService.svc/ToggleMode",
dataType: "json",
data: JSON.stringify(params, null, null),
contentType: "application/json; charset=utf-8",
success: function (data) {
// ...
},
error: function() {
// ...
}
});