![](/img/trans.png)
[英]How to send multipart/form-data to ASP.NET Core Web API?
[英]ASP.NET send multipart/form-data to Power Automate
我正在嘗試將 multipart/form-data 發送到 Power Automate“收到 HTTP 響應時”觸發操作(webhook)。
我像這樣在 Postman 中生成一個 RestSharp 請求......
var client = new RestClient("https://prod-122.westeurope.logic.azure.com:443/workflows/********************************/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=***********************");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "multipart/form-data");
request.AddFile("file", @"C:\Temp\MyFile.pdf");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
使用 Postman 發送上述工作正常,Power Automate 操作被觸發,如 Power Automate 日志中所示。 使用 ASP.NET web 表單發送似乎失敗,即 Power Automate 日志中沒有記錄。
如果沒有代理,我在response
中收到錯誤“遠程服務器返回錯誤:(407) 需要代理身份驗證。”
使用代理時,我在response
中收到錯誤“底層連接已關閉:發送時發生意外錯誤”
有任何想法嗎?
意外錯誤與協議有關。 在實例化RestClient
之前插入以下行解決了該問題。
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.