【发布时间】:2017-07-28 02:57:47
【问题描述】:
我正在尝试在 Azure 函数中获取表单数据。
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
log.Info("C# HTTP trigger function processed a request.");
NameValueCollection col = req.Content.ReadAsFormDataAsync().Result;
return req.CreateResponse(HttpStatusCode.OK, "OK");
}
我收到以下错误:
执行函数时出现异常:System.Net.Http.Formatting:没有 MediaTypeFormatter 可用于从媒体类型为“multipart/form-data”的内容中读取“FormDataCollection”类型的对象。
我正在尝试通过 SendGrid 解析入站电子邮件,如此处所述。 https://sendgrid.com/docs/Classroom/Basics/Inbound_Parse_Webhook/setting_up_the_inbound_parse_webhook.html
传入的请求看起来正确。
--xYzZY 内容处置:表单数据;名称="附件"
0 --xYzZY 内容处置:表单数据;名称="文本"
你好世界 --xYzZY 内容处置:表单数据;名称="主题"
主题 --xYzZY 内容处置:表单数据;名称="到"
【问题讨论】:
标签: c# function azure sendgrid