使用Azure Function处理文件 [英] Process a file using Azure Function
问题描述
我想处理一个输入文件,并将其输出到ex的某个位置. FTP或Azure存储.我正在尝试将Azure函数与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 Welcome, you are now connected to log-streaming service.
2016-07-14T00:45:00.580 Script for function 'HttpTriggerCSharp1' changed. Reloading.
2016-07-14T00:45:00.580 Compiling function script.
2016-07-14T00:45:00.721 run.csx(24,25): error CS0622: Can only use array initializer expressions to assign to array types. Try using a new expression instead.
2016-07-14T00:45:00.721 Compilation failed.
2016-07-14T00:44:53 Welcome, you are now connected to log-streaming service.
2016-07-14T00:45:00.580 Script for function 'HttpTriggerCSharp1' changed. Reloading.
2016-07-14T00:45:00.580 Compiling function script.
2016-07-14T00:45:00.721 run.csx(24,25): error CS0622: Can only use array initializer expressions to assign to array types. Try using a new expression instead.
2016-07-14T00:45:00.721 Compilation failed.
这是我的功能签名:
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触发器. 以下是一个示例,该示例监视文件夹(输入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屋!