【发布时间】:2016-08-17 00:29:47
【问题描述】:
我创建了一个 WebJob,以便在创建文件时从 Azure 文件中读取文件。 当我在本地运行它时它可以工作,但当我发布 WebJob 时它不会。
我的 Main() 函数是:
static void Main()
{
string connection = "DefaultEndpointsProtocol=https;AccountName=MYACCOUNTNAME;AccountKey=MYACCOUNTKEY";
JobHostConfiguration config = new JobHostConfiguration(connection);
var filesConfig = new FilesConfiguration();
if (config.IsDevelopment)
{
config.UseDevelopmentSettings();
filesConfig.RootPath = @"c:\temp\files";
}
config.UseFiles(filesConfig);
var host = new JobHost(config);
// The following code ensures that the WebJob will be running continuously
host.RunAndBlock();
}
创建文件时要触发的函数是:
public void TriggerTest([FileTrigger(@"clients\{name}", "*.txt", WatcherChangeTypes.Created)] Stream file, string name, TextWriter log)
{
log.WriteLine(name + " received!");
// ...
}
WebJob 发布时我得到的错误是:
[08/17/2016 00:15:31 > 4df213: ERR ] Unhandled Exception: System.InvalidOperationException: Path 'D:\home\data\clients' does not exist.
这个想法是让 WebJob 在 Azure Files 的“clients”文件夹中创建新文件时触发。
有人可以帮我吗?
【问题讨论】:
-
客户文件夹的路径应该是什么?
-
客户端文件夹位于我的 Azure 存储的根级别。
标签: azure-webjobs azure-webjobssdk