Below is my project Structure:
ProjectX
- www (folder)
- - index.html (target file that want to access)
- MyFunc.cs (Function)
- local.settings.json
After I deployed to Azure Linux Function, I could not find a way to find index.html
.
I tried below paths already:
- /home/site/wwwroot/
- /home/site/wwwroot/MyFunc/
- /home/site/
- /home/site/wwwroot/bin/
- /home/site/wwwroot/bin/runtimes
Below is my coding for checking file:
public static async Task Run([ServiceBusTrigger(ServiceBusContext.MyQueueName, Connection = "ServiceBus")] Message msg, ILogger log)
{
// change to different paths
var testDir1 = new DirectoryInfo($@"/home/site/wwwroot/");
FindFileInfo(testDir1, log);
}
public static void FindFileInfo(DirectoryInfo dir, ILogger log)
{
FileInfo[] files = dir.GetFiles();
foreach (FileInfo file in files)
{
log.LogInformation("Check File, RootDir=" + dir.FullName + ", File: {0}", file.Name);
}
}
Can use
context.FunctionAppDirectory
: