0
나는 ajax를 사용하여 webservice를 호출하려고하는데, 내부 500 ERROR를 얻었습니다. 어떤 일을 잘못하고 있는지, 내가 문제가없는 webmethod를 호출 할 수 있는지 조언 해 주실 수 있습니까? .jquery ajax jsonp와 webservice 호출 : 오류
JQUERY AJAX CALL
<script type="text/javascript">
function LoginVailid() {
$.ajax({
url: "http://localhost:49301/AppService.asmx/LoggonAuthentication",
contentType: "application/json; charset=utf-8",
data: "{}",
dataType: "jsonp",
jsonp: "callback",
crossDomain: true,
success: function (json) {
alert(json.d);
},
error: function() {
alert("Hit error fn!");
}
});
}
</script>
WEBSERVICE 방법
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public string LoggonAuthentication()
{
return "Hello World";
}
}
당신은 JSON'에 jsonp''에서 변화'dataType'를 시도 할 수 ' –
내가 그렇게하면 다음 ERROR.XMLHttpRequest를 얻을 수 없습니다. 광고 http : // localhost : 49301/AppService.asmx/LoggonAuthentication? {}. 'Access-Control-Allow-Origin'헤더가 요청 된 리소스에 없습니다. 따라서 'http : // localhost : 55255'는 액세스가 허용되지 않습니다. 응답에 HTTP 상태 코드 500이 있습니다. –
> 아약스를 사용하여 webservice를 호출하려고합니다. 내부 500 오류가 발생했습니다. 실제 예외를 디버그하고 확인할 수 있습니까? –