안녕하세요, WCF와 관련된 문제가 있습니다. 어떤 이유로 든 전혀 데이터를 보내지 않거나 500 개의 내부 서버 오류가 발생합니다 ... 즉, WCF는 내가 보내는 것을 전혀 알지 못합니다. WrappedRequest로 변경하면 서비스를받을 수 있습니다. 아무 것도 보내지지 않습니다. 누구든지 내가 뭘 잘못하고 있는지 알 수 있니? 여기 자바 스크립트입니다Jquery가 게시물의 WCF로 데이터를 보내지 않습니다.
var data = { UserId: 2, Name: "test" };
$.ajax({
url: 'http://localhost:54900/MyService.svc/SaveName',
type: "POST",
cache: false,
dataType: "json",
contentType: "application/json; charset=utf-8",
data: $.toJSON(data),
error: function (data, textStatus, errorThrown) {
alert(errorThrown);
},
success: function (data, textStatus, jqXHR) {
alert('success');
}
});
[WebInvoke(Method = "POST", BodyStyle
= WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
이 문제를 발견했습니다. enablewebscript를 제거하고 webHttp에 남겨 두어야했습니다. 이로 인해 문제가 해결되었습니다.