Azure 逻辑应用 returns 文件内容作为编码字符串

Azure logic app returns file content as encoded string

我需要使用 azure logic app

将保存在一个驱动器中的一个 Excel 文件传递​​给 azure function app

我创建了用于读取 excel 文件的函数应用程序,当我通过邮递员以表单数据类型 [=14 发送 excel 文件时它工作正常=]

我试过 base64 , utf-8 , utf-16 在 azure 函数 a 中创建 excel 文件的编码和解码方式 通过参考一些 Whosebug 问题和文档,但我不能

当我使用下面的代码时

    byte[] fileinbytes = Convert.FromBase64String(file);
    File.WriteAllBytes("abcd.xlsx", fileinbytes);

它抛出异常

The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

问题是如何将这些字符串解码到我的函数应用程序中的文件或如何将这些编码字符串读取为 excel 文件

谢谢

I fixed the Issue

我在 逻辑应用程序代码视图 功能中更改了来自逻辑应用程序的 Azure 函数请求,如下所示

            "body": {
                "file": "@{base64(body('Get_file_content'))}"
            },

现在是我的 azure 函数

        string file = req.Query["file"];
        string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
        dynamic data = JsonConvert.DeserializeObject(requestBody);
        file = file ?? data?.file;
        byte[] fileinbytes = Convert.FromBase64String(file);
        File.WriteAllBytes("abcd.xlsx", fileinbytes);