This problem has been presented in a number of posts in similar ways without a viable solution to mine.
My service endpoint in ManagerDiscountService looks like:
[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 -->
I’m trying to post userId, pwd and domain to this endpoint, but all I see are 500’s. Why doesn’t this method of posting work? When I debug in Chrome, error is always the next execution in $.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() {
// ...
}
});
::sigh:: this was corrected by replacing the
wsSecureHttpbinding withwsHttp