我已经使用已部署的 Web 服务部署了 AzureML 发布的实验。我尝试使用配置页面中提供的示例代码,但通用应用程序尚未实现 Http.Formatting,因此我无法使用postasjsonasync。
我试图尽可能地遵循示例代码,但我得到的状态码为 415“不支持的媒体类型”,我在做什么错误?
var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
// client.BaseAddress = uri;
var scoreRequest = new
{
Inputs = new Dictionary<string, StringTable>() {
{
"dataInput",
new StringTable()
{
ColumnNames = new [] {"Direction", "meanX", "meanY", "meanZ"},
Values = new [,] { { "", x.ToString(), y.ToString(), z.ToString() }, }
}
},
},
GlobalParameters = new Dictionary<string, string>() { }
};
var stringContent = new StringContent(scoreRequest.ToString());
HttpResponseMessage response = await client.PostAsync(uri, stringContent);
非常感谢