Asp.net web api 值不能为null。参数名称:value,通过ajax post调用httppost时

Asp.net web api 值不能为null。参数名称:value,通过ajax post调用httppost时,asp.net-web-api,Asp.net Web Api,我正在尝试接收带有json字符串的post请求 var contentType ="application/x-www-form-urlencoded; charset=utf-8"; $.ajax({ type: "POST", data: JSON.stringify(fileData), url: "http://hercules/JsonTest/api/Getjson/sendData",

我正在尝试接收带有json字符串的post请求

var contentType ="application/x-www-form-urlencoded; charset=utf-8";
$.ajax({
              type: "POST",
              data: JSON.stringify(fileData),
              url: "http://hercules/JsonTest/api/Getjson/sendData",
              contentType: contentType,
              processData: false,
              error: function (qXHR, textStatus, errorThrown) {
                  alert("failure: " + qXHR.status + ":" + textStatus + errorThrown);
              },
              success : function(data) {
                  alert("Success : " + data);
              }
          });
在我的webapi中

[System.Web.Http.HttpPost]
        [System.Web.Http.ActionName("sendData")]
        public string sendData([FromBody] string jsonString)
        {
            logData("Entering SendData : " + jsonString);
            return "Success";
        }
但是,webapi中没有收到我发布的jsonString。正在抛出错误值,错误值不能为null。 参数名称:value

原因可能是什么。 我在我的VisualStudio中直接测试代码,同样工作正常。但一旦我在机器中发布了相同的内容,并试图通过JSFIDLE访问,那么字符串就会显示为空。

我解决了这个问题。 在我的ajax post请求中,我修改了

数据:JSON.stringify(fileData),数据:'='+fileData,

添加等于后,数据在MVC的HTTPPOST方法中正确接收

谢谢