【发布时间】:2018-07-02 12:03:42
【问题描述】:
这里是function.json sn-p
{
"bindings": [
{
"authLevel": "function",
"name": "query",
"type": "httpTrigger",
"direction": "in",
"methods": [
"get",
"post"
]
这是我的 run.csx 文件:
public class Query{
public double AdvanceDays{get;set;}
}
public static async Task<HttpResponseMessage> Run(Query query,entity Entity,HttpRequestMessage req, TraceWriter log, IEnumerable<dynamic> inputDocument)
{
现在我需要从另一个函数调用这个 Http 触发函数。我在做:
var url = "https://azurefunction...";
var content2 = new StringContent(string.Format("{{\"AdvanceDays\":7}}"));
var response = await client.PostAsync(url,content2);
但我收到以下错误:
No MediaTypeFormatter is available to read an object of type 'Query' from content with media type 'text/plain'.
我该如何解决这个问题?请帮忙!!!
【问题讨论】:
标签: c# azure http-post azure-functions