我有一个这个WebMethod:
/// <summary>
/// Check if a User Name is valid
/// </summary>
/// <param name="UserName"></param>
/// <param name="UserPassword"></param>
/// <returns></returns>
[WebMethod]
public static Object LogUser(String UserName, String UserPassword)
{
try
{
return new BLL.LogIn().LogUser(UserName, UserPassword);
}
catch
{
return false;
}
}
在这个.js中调用
function LogUser() {
var UserName = document.getElementById('txt_usr').value;
var UserPassword = document.getElementById('txt_pass').value;
// Validations
if (UserName == "")
{
alert("Falta informar el nombre del Usuario");
return;
}
if (UserPassword == "") {
alert("Falta informar el password del Usuario");
return;
}
PageMethods.LogUser(UserName, UserPassword, onSucess, onError);
function onSucess(result) {
if (result == false) {
alert("El Usuario o Contraseña incorrecto");
}
else
{
alert("true");
windows.location.href = 'List.aspx';
}
alert('Sucess');
}
function onError(error) {
alert("Error: " + error.get_message() + "; " +
"Stack Trace: " + error.get_stackTrace() + "; " +
"Status Code: " + error.get_statusCode() + "; " +
"Exception Type: " + error.get_exceptionType() + "; " +
"Timed Out: " + error.get_timedOut());
windows.location.href = 'errorManipulation.aspx';
}
}
使用此Web.Config
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime executionTimeout="3600" maxRequestLength="2147483647" />
</system.web></configuration>
我得到的问题是90%的时间,返回得到OnError,但是当我调试数据时,在WebMethod中该函数就可以了。
这是错误:
Error on the server method 'logUser' ; Stack Trace; Status Code: 0; Exeption Type:; Timed Out: false
有人知道可能导致这种情况的原因吗?