【问题标题】:ASP.NET send multipart/form-data to Power AutomateASP.NET 将 multipart/form-data 发送到 Power Automate
【发布时间】:2020-05-19 19:13:55
【问题描述】:

我正在尝试将 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 出现错误“底层连接已关闭:发送时发生意外错误”

有什么想法吗?

【问题讨论】:

    标签: c# asp.net postman restsharp power-automate


    【解决方案1】:

    意外错误与协议有关。在实例化 RestClient 之前插入以下行可解决问题。

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12;
    

    【讨论】:

      猜你喜欢
      • 2019-06-22
      • 2018-04-08
      • 1970-01-01
      • 2013-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多