Json “休息服务返回”;远程服务器返回错误:(415)不支持的媒体类型。”;
我可以通过POSTMAN成功连接到rest服务,但是当我尝试在.Net中使用WebClient时,从webservice返回时出错 服务错误:“远程服务器返回错误:(415)不支持的媒体类型。”Json “休息服务返回”;远程服务器返回错误:(415)不支持的媒体类型。”;,json,rest,webclient,media-type,Json,Rest,Webclient,Media Type,我可以通过POSTMAN成功连接到rest服务,但是当我尝试在.Net中使用WebClient时,从webservice返回时出错 服务错误:“远程服务器返回错误:(415)不支持的媒体类型。” using (var client = new WebClient()) { // Request configuration client.Headers.Add("X-Signature", si
using (var client = new WebClient())
{
// Request configuration
client.Headers.Add("X-Signature", signature);
client.Headers.Add("Api-Key", apiKey);
client.Headers.Add("Accept", "application/json");
client.Headers.Add("Content-Type", "application/json");
client.Headers.Add("Media-Type", "application/json");
// Request execution
string response = client.DownloadString(endpoint);
string r = client.UploadString(hotelDetailsEndpoint, inputJson);
}