Kendo Ui Grid から Web API にデータを POST しようとしています
var crudServiceBaseUrl = "http://127.255.0.1:8081/api",
dataSource = new kendo.data.DataSource({
transport: {
read: {
url: crudServiceBaseUrl + "/meeting",
dataType: "jsonp",
},
update: {
type: "POST",
url: crudServiceBaseUrl + "/meeting/postmeeting",
contentType: "application/json; charset=utf-8",
dataType: 'json',
success: function (msg) {
alert("success");
}
},
.....
$("#grid").kendoGrid({
dataSource: dataSource,
pageable: true,
toolbar: ["create"],
columns: [
{ field: "Organizer", title: "Organizer" },
{ field: "Title", title: "Title" },
{ field: "Location", title: "Location", },
{ command: ["edit", "destroy"], title: " ", width: "160px" }],
editable: "inline"
});
しかし、私が更新するとき
405 エラーが発生する
Request URL:http://127.255.0.1:8081/api/meeting/postmeeting
Request Method:OPTIONS
Status Code:405 Method Not Allowed
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Access-Control-Request-Headers:accept, origin, content-type
Access-Control-Request-Method:POST
Host:127.255.0.1:8081
Origin:http://localhost:30320
Proxy-Connection:keep-alive
リクエストメソッドがオプションになった理由を誰かに説明してもらえますか? その結果、ASP.NET Web API の POST メソッドが呼び出されません
[HttpPost]
public HttpResponseMessage PostMeeting(MeetingEntity meeting)
{
_meetingRepository.Update(meeting);
return new HttpResponseMessage(HttpStatusCode.OK);
}