Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is is possible to browse an Azure App Service temp directory?

I am using the Kudu Dashboard to browse the folder of my Azure App Service. Specifically, I am browsing the D:\local\Temp\ since that is supposed to be (as far as I understand) the folder used to store temporary files created by my web app. For reference, here is a screenshot of the Kudu dashboard:

enter image description here

You can see from the screenshot that there is a file called xyz.tmp, this file is a file that I created manually trough the Kudu dashboard.

All this is good, however, when I try to read the file from my web app by using code such as:

var fileContent = System.IO.File.ReadAllText(@"D:\local\Temp\xyz.tmp");

I get an error stating that the file can't be found.

So my question is, what is going on? Why do I get the error? Also, I noticed that when I create a file in the same App Service temp director using code such as:

var fn = System.IO.Path.GetTempFileName();
System.IO.File.WriteAllText(fn, "abc123");

and then I try browsing for the file using the Kudo dashboard I don't see it in the temp directory.

So essentially, it all seems to point to the temp folder being displayed by the Kudo dashboard not representing the real temp folder used by the App Service. So if that is not the case then how exactly are you supposed to be able to browser the App Service temp folder?

Thanks.

like image 950
T555 Avatar asked Aug 25 '18 01:08

T555


1 Answers

From https://github.com/projectkudu/kudu/wiki/Understanding-the-Azure-App-Service-file-system:

Another important note is that the Main site and the scm site do not share temp files. So if you write some files there from your site, you will not see them from Kudu Console (and vice versa). You can make them use the same temp space if you disable separation (via WEBSITE_DISABLE_SCM_SEPARATION). But note that this is a legacy flag, and its use is not recommended/supported.

like image 174
David Ebbo Avatar answered Sep 18 '22 11:09

David Ebbo