この問題は、私の実行可能な解決策なしに、同様の方法で多くの投稿で提示されています。
のサービスエンドポイントは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)
web.config:
<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() {
// ...
}
});