首页 文章

将大型文件的内容从标准Logic应用程序传递到API应用程序

提问于
浏览
0

我正在使用Swashbuckle的ASP.NET Web API项目来测试一个简单的自定义API应用程序,它接受2个参数:文件名和文件内容 .

public class Parm
{
    public string FileName { get; set; }
    public string FileContent { get; set; }
}

昂首阔步:

{
  "FileName": "string",
  "FileContent": "string"
}

我在将此API应用与 Logic app 集成时存在问题,例如:处理在OneDrive文件夹中创建的所有文件,如下所示:

在OneDrive中触发

  • "When a file is created"

  • 使用上一步中的参数 File nameFile content 调用自定义API应用 .

只要上传的文件相对较小,一切正常,但是对于较大的文件(例如10 MB), FileContent 被视为空,并且该过程的逻辑可理解地失败 .

知道问题的原因是什么?我已经尝试将 FileContentstring 更改为其他类型( Stream 等),但这不起作用 . 只有上一步中的以下参数可用: File contentFile content type271126File identifierFile nameFile path .

标准API 's such as 2791130 , etc. don' t有任何问题处理大 File content 所以肯定必须有一种方法来实现它 . 谢谢 .

1 回答

  • 1

    可以通过在API应用程序的Web.config中增加 HttpRuntimeSection.MaxRequestLength 属性的值来修复此问题:

    <configuration>  
        <system.web>  
            <httpRuntime maxRequestLength="12288" />  
        </system.web>  
    </configuration>
    

    Default value is 4096 KB .

相关问题