C# 无法使用Angularjs$http.PUT进行PUT,接收无效的JSON原语

C# 无法使用Angularjs$http.PUT进行PUT,接收无效的JSON原语,c#,json,asp.net-mvc-3,angularjs,C#,Json,Asp.net Mvc 3,Angularjs,我有以下服务定义 app.factory('savedPropertiesService', ['$http', function ($http) { var sessionId = $('input[name=SessionGuid]').val(); var contactId = $('input[name=ContactId]').val(); var savedPropertiesService = {}; savedPropertiesService

我有以下服务定义

app.factory('savedPropertiesService', ['$http', function ($http) {
    var sessionId = $('input[name=SessionGuid]').val();
    var contactId = $('input[name=ContactId]').val();
    var savedPropertiesService = {};

    savedPropertiesService.getSavedProperties = function () {
        return $http.get("/Contact/SavedProperties?sessionGuid="+sessionId+"&contactId=" + contactId);
    };

    savedPropertiesService.refreshSavedProperties = function () {
        return $http.get('/Contact/RefreshSavedProperties?sessionGuid=' + sessionId + '&contactId=' + contactId);
    };

    savedPropertiesService.deleteSavedProperty = function (listingKey) {
        return $http['delete']('/Contact/DeleteSavedProperty?sessionGuid=' + sessionId + '&contactId=' + contactId + '&id=' + listingKey);
    };

    savedPropertiesService.updateSavedProperty = function (prop) {
        return $http.put('/Contact/UpdateSavedProperty/', prop);
    };

    return savedPropertiesService;
}]);
它被用在我的控制器上,就像这样

$scope.$watch('items', function (newVal, oldVal) {
    if (_.isEmpty(newVal) || _.isEmpty(oldVal)) return;
    var prop = difference(newVal, oldVal);


    savedPropertiesService.updateSavedProperty(prop)
        .success(function (data) {
            $scope.status = data;
        })
        .error(function (error) {
            $scope.status = 'Unable to update saved properties data: ' + error.message;
        });    
}, true);
和服务端点(请不要判断VB)


函数将SavedProperty(评级为RatingDto)更新为JsonResult
返回Json(ControlLibrary.CS.\uu PropDetails.ContactPropertiesDataFactory.UpdateSaveProperty(rating),JsonRequestBehavior.DenyGet)
端函数
无论我做什么,无论我是否使用JSON.stringify,我的mvc3 enpoint都永远不会到达,框架都会抛出一个异常。System.ArgumentException:JSON原语无效

我甚至试着发布一个手工制作的对象,看看它是否能到达端点,但都没有用

有人对代码的错误有什么建议吗

谢谢,,
Stephen发现我为$http定义了一个全局转换,它使用jQuery.param()进行编码。一旦我去掉这个,它就工作得很好了

var app = angular.module('app', ['ui.select2', 'ui.bootstrap'])
    .config(['$httpProvider', function ($httpProvider) {
        delete $httpProvider.defaults.headers.common['X-Requested-With'];
        $httpProvider.defaults.transformRequest = function (data) {
            if (data === undefined) {
                return data;
            }
            return $.param(data);
        };
}]);
var app = angular.module('app', ['ui.select2', 'ui.bootstrap'])
    .config(['$httpProvider', function ($httpProvider) {
        delete $httpProvider.defaults.headers.common['X-Requested-With'];
        $httpProvider.defaults.transformRequest = function (data) {
            if (data === undefined) {
                return data;
            }
            return $.param(data);
        };
}]);