Azure関数を使用してファイルをFTPに保存しようとしています。 JSONはこれです:Azure関数のエラー - パラメーターをString型にバインドできません。
{
"type": "apiHubFile",
"name": "outputFile",
"path": "{folder}/ps-{DateTime}.txt",
"connection": "ftp_FTP",
"direction": "out"
}
機能コードはこれです:私は、フォルダ名とそれを{フォルダ}を交換する場合
Function ($SaveToFtp) Error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.SaveToFtp'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'folder' to type String. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
:
public static void Run(string myEventHubMessage, TraceWriter log, string folder, out string outputFile)
{
var model = JsonConvert.DeserializeObject<PalmSenseMeasurementInput>(myEventHubMessage);
folder = model.FtpFolderName;
outputFile = $"{model.Date.ToString("dd.MM.yyyy hh:mm:ss")};{model.Concentration};{model.Temperature};{model.ErrorMessage}";
log.Info($"C# Event Hub trigger Save-to-ftp function saved to FTP: {myEventHubMessage}");
}
私が手にエラーがこれです作品:
"path": "psm/ps-{DateTime}.txt"
なぜですか?コードからパスを変更することはできませんか?
これは機能します。 :)この資料をどこで読んだのですか...私はドキュメントでそれを見なかった...または多分私はそれを逃した... –
@AlexAlbu私の答えへのリンクを追加しました。それはあまり詳細ではありませんが、例があります。 – Mikhail