0
wcf 4.0 나머지 템플릿을 가지고 놀고 jquery와 함께 작동 시키려고합니다.wcf rest 4 서비스에 게시를 시도 할 때 잘못된 요청이 발생했습니다.
나는 새로운 휴식 템플릿 프로젝트를 만들었고 동일한 프로젝트에 단순한 작업을 위해 웹 폼을 추가했습니다.
나는 약간 그럼 내 웹 양식에서 내가 이것을 사용하고이
[WebInvoke(UriTemplate = "", Method = "POST")]
public string Create(SampleItem instance)
{
// TODO: Add the new instance of SampleItem to the collection
return (instance.Id == 1) ? "1 was returned" : "something else was returned";
}
처럼 보이도록 만들기 방법을 modfied있다.
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
type: 'POST',
url: "/service1/",
data: { "Id": 1,"StringValue": "String content"
},
success: function (data) {
$('.result').html(data);
},
error: function (error) {
$('.result').html(error)
},
dataType: "json",
contentType: "application/json; charset=utf-8"
});
});
</script>
<div class="result"></div>
그러나 피들러는 400 오류가 발생하여 요청 오류가 있음을 알립니다. 내가 잘못 했니?