Google Chrome ブラウザーで WCF 例外が空の Jquery エラーを返す
パスワードを送信する wcf があります。エラーを強制しようとしましたが、$ の Chrome ブラウザーは空を返します。jquery ajax エラーです。
wcfUser.svc:
[OperationContract ()、WebInvoke (メソッド = "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:
$. ajax ({
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 では空が返され、他のブラウザーではエラーが正しく返されます。