WCF 异常在 Google Chrome 浏览器中返回空 Jquery 错误
我有一个发送密码的 wcf。我尝试强制出错,但 $ 的 Chrome 浏览器返回空。jquery ajax 错误。
wcfUser.svc:
[OperationContract(), WebInvoke (Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat WebMessageFormat.Json =)]
public string lembrarSenha () { try { int id = Convert.ToInt32 ("asssaas"); return id.ToString(); } catch (Exception ex) { HttpContext.Current.Response.Write (ex.Message); HttpContext.Current.Response.ContentType = "application/json"; HttpContext.Current.Response.Flush (); return ex.Message; } }
jQuery:
美元。阿贾克斯({
url: "wcf/wcfUser.svc/lembrarSenha", type: "POST", contentType: "application/json; charset=utf-8", dataType: 'json', ProcessData: true, success: function (msg) { if (msg.d == true) { alert ("Please check your inbox for your email."); Else {} alert ("Email is not registered in the system."); } } error: function (XHR, ErrorText, thrownError) { alert (xhr.responseText); } });
必须返回错误,但在 Chrome 中返回空,在其他浏览器中正确返回错误。