我正在将数据从数据库传递到API。
string[,] vendors = new string[100, dr.FieldCount];
假设vendors
有值。
我的客户是:
using (var client = new WebClient())
{
client.Headers[HttpRequestHeader.ContentType] = "application/json";
string serialisedData = JsonConvert.SerializeObject(vendors);
var response = client.UploadString(getVendorURL, serialisedData);
result = JsonConvert.DeserializeObject(response);
}
我的API如下:
public IHttpActionResult GetVendorExport([FromBody]string[,] vendors)
{
return Ok("This is a string");
}
供应商为空。怎么了?谢谢