2011-02-16 5 views
2

WebService을 호출하는 ajax 쿼리가 있습니다. 그것은 작동하고 그 일을하고 전혀 아무것도 반환하지 않습니다 (그것은 무효입니다). 디버깅하는 동안 응용 프로그램에 오류가 없습니다. 하지만 jquery .ajax의 오류 이벤트는 계속 실행됩니다. textStatus 및 errorThrown은 정의되지 않습니다. XMLHttpRequest에는 오류 상태가 표시되지 않습니다.jQuery ajax에서 asp.net WebService에 대한 오류 응답이 있지만 오류가 없습니다.

왜이 쿼리가 오류 응답을 얻고 있다고 생각합니까?

또한 홀수 : WebMethod에 중단 점을 넣으면 메서드가 끝나기 전에 클라이언트에서 오류가 발생합니다. 끝내기를 기다리는 것 같지 않습니다. 오류 이벤트가 바로 끝납니다. 나는

$.ajax({ 
     url: baseUrl() + "/webservices/usersetting.asmx/SetSetting", 
     type: "POST", 
     contentType: "application/json; charset=utf-8", 
     dataType: "json", 
     async: true, 
     data: $.toJSON(ajaxData), 
     success: function (data) { 
      alert('success'); 
     }, 
     error: function (XMLHttpRequest, textStatus, errorThrown) { 
      alert("Error: " + errorThrown + " data: " + ajaxData.id); 
     } 
    }); 

오류 이벤트에서 디버깅 할 때 ...이 문제는 여기에 함께 할 수있는 뭔가가 기대 :

XMLHttpRequest 
abort: function(){w&&Function.prototype.call.call(g,w);L("abort")} 
onabort: null 
onerror: null 
onload: null 
onloadstart: null 
onprogress: null 
onreadystatechange: function(){} 
readyState: 4 
response: "" 
responseText: "" 
responseType: "" 
responseXML: null 
status: 0 
statusText: "" 
upload: XMLHttpRequestUpload 
withCredentials: false 
__proto__: XMLHttpRequest 

것은 여기에 방법이다. 나는 void return과 "true"로 시도했다. Xml과 Json의 응답 형식을 시도했습니다. 차이 없음.

[WebMethod(EnableSession = true), 
ScriptMethod(ResponseFormat = ResponseFormat.Xml)] 
public string SetSetting(List<UserSettingData> data) 
{ 
    UserSettingManager setMgr = new UserSettingManager(Global.UserSession.UserID); 
    foreach (UserSettingData item in data) 
    { 
     setMgr.SetSetting(item.name, item.value); 
    } 

    return (jsonString(true)); 
} 
+0

이 것이 상호 도메인 요청입니까? –

+0

아니, 모두 내 dev 컴퓨터에서 지금 실행 중입니다. –

+0

피들러 2를 설치하고 몇 가지 추가 정보를 얻을 수 있는지 확인하는 것이 좋습니다. XMLHttpRequest의 상태 값은 성공한 경우 200이어야합니다. –

답변

0

Visual Studio를 다시 시작한 후에 문제가 해결되었습니다. 이유는 모르겠지만 끝났고 끝났습니다.

관련 문제