Я использую angularjs для публикации созданных данных webapi. его работа над моей локальной системой, но когда я загрузил на сервер свою нерабочую и возвращающую ошибку, неподдерживаемый тип носителя. пожалуйста, помогите мне, как это исправить.неподдерживаемый тип носителя web api post
<script>
var app = angular.module('MyApp', []);
app.controller("QueryControllerController", function ($scope, $http) {
$scope.submit = function() {
if ($scope.QueryDescription) {
var product = {
"QueryDescription": $scope.QueryDescription,
"CategoryID": $scope.CategoryID
}
$http.post('/api/querycontroller', JSON.stringify(product)).
success(function (data, status, headers, config) {
alert('Added Successfully' + headers);
$('#formusers')[0].reset();
}).
error(function (data, status, headers, config) {
alert(status + ", " + data + ", " + headers + "," + config);
});
}
};
}
);
мой код контроллера АФИ:
[ResponseType(typeof(Query))]
[HttpPost]
public HttpResponseMessage Post([FromBody]Query Services)
{
Services.CommunityID = UserStatus.GetUserID(User.Identity.Name);
Services = repository.Add(Services);
var response = Request.CreateResponse<Query>(HttpStatusCode.Created, Services);
string uri = Url.Route(null, new { id = Services.QueryID });
response.Headers.Location = new Uri(Request.RequestUri, uri);
return response;
}
Когда я пытаюсь отправить, я получаю ответ неподдерживаемых Тип носителя .:
"Message": "The request entity's media type 'text/plain' is not supported for this resource."