使用 Azure Function 处理文件 [英] Process a file using Azure Function
问题描述
我想处理一个输入文件并将其输出到某个位置,例如.FTP 或 Azure 存储.我正在尝试将 Azure Function 与 SaasFile 输入/输出一起使用.我收到以下错误:
I would like to process an input file and output it to some location for ex. FTP or Azure storage. I am trying to use Azure Function with SaasFile input/output. I am getting below error:
2016-07-14T00:44:53 欢迎您,您现在已连接到日志流服务.2016-07-14T00:45:00.580 函数HttpTriggerCSharp1"的脚本已更改.重新加载.2016-07-14T00:45:00.580 编译函数脚本.2016-07-14T00:45:00.721 run.csx(24,25):错误 CS0622:只能使用数组初始化表达式分配给数组类型.尝试改用新的表达式.2016-07-14T00:45:00.721 编译失败.
这是我的函数签名:
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, string output, TraceWriter log)
绑定:
{
"bindings": [
{
"authLevel": "function",
"name": "req",
"type": "httpTrigger",
"direction": "in"
},
{
"name": "res",
"type": "http",
"direction": "out"
},
{
"type": "apiHubFile",
"name": "output",
"path": "path/{file}",
"connection": "ftp_FTP",
"direction": "out"
}
],
"disabled": false
}
我想我在运行签名中遗漏了一些东西.我在 Azure 文档 上找不到它.
I think I am missing something in Run signature. I couldn't find it on Azure documentation.
我需要帮助了解如何使用 FTP 和 Azure 存储进行处理.谢谢你的帮助.
I need help figure out how to process using FTP and Azure Storage. Thanks for your help.
推荐答案
您实际上并不需要一个 http 触发器.这是一个示例,它在 Dropbox 中监视文件夹(输入-cs)中的新文件,并将文件复制到 googledrive 中的文件夹(输出-cs):
You don't really need a http trigger for this. Here is an example which watches a folder(input-cs) for new files in dropbox and copies the file to a folder (output-cs) in googledrive:
using System;
public static void Run(string input, out string output, TraceWriter log)
{
output = input;
}
绑定:
{
"bindings": [
{
"type": "apiHubFileTrigger",
"name": "input",
"direction": "in",
"path": "input-cs/{name}",
"connection": "dropbox_DROPBOX"
},
{
"type": "apiHubFile",
"name": "output",
"direction": "out",
"path": "output-cs/{name}",
"connection": "googledrive_GOOGLEDRIVE"
}
],
"disabled": false
}
这篇关于使用 Azure Function 处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!