Azure Web Job将文件写入网站目录中 [英] Azure Web Job writes files in a website's directory
问题描述
我将Web作业附加到了我的Azure网站.网络作业准备了一个文件,我想将其保存在网站上的适当文件夹中.
I attached a Web Job to my Azure website. The webjob prepares a file and I want to save it on a proper folder in the website.
Environment.CurrentDirectory
返回Temp目录下的路径:Temp\jobs\triggered\WEBJOBNAME\q0uwrohv.x5e
Environment.CurrentDirectory
run on the script returns a path under a Temp directory: Temp\jobs\triggered\WEBJOBNAME\q0uwrohv.x5e
我尝试查看目录树:
string path = Path.Combine(Environment.CurrentDirectory, @"..\..\..\..\..\Data")
但这不起作用:
C:\DWASFiles\Sites\WEBSITENAME\Temp\jobs\triggered\WEBJOBNAME\q0uwrohv.x5e\..\..\..\..\..\Data
如何将WebJob中的文件制作和保存到特定路径?
How to make and save files from WebJob to a particular path?
我不想使用blob存储.
I don't want to use blob store.
推荐答案
Azure网站根目录的路径通常是d:\home\site\wwwroot
.
d:\home
也存储在名为%HOME%
的环境设置中.
The path for the root of your Azure Web Site is (usually) d:\home\site\wwwroot
.
d:\home
is also stored in an environment setting called %HOME%
.
要了解有关您可以在网站上使用的不同路径的更多信息,请访问:
https://{sitename}.scm.azurewebsites.net
,您将拥有调试控制台,您可以在其中浏览站点和 Environment 以查看可以使用的所有环境变量.
To get more insight on the different paths you can use on your site go to:
https://{sitename}.scm.azurewebsites.net
, there' you'll have the Debug Console where you can browse through your site and Environment to see all the environment variables you can use.
您的WebJob将有权访问与您的网站相同的路径/环境.
Your WebJob will have access to the same paths/environment as your Web Site.
有关此管理网站的更多信息,请访问: http://azure.microsoft.com/blog/2014/03/28/windows-azure-websites-online-tools-you-should-know-about-2/
For more information on this administration site go to: http://azure.microsoft.com/blog/2014/03/28/windows-azure-websites-online-tools-you-should-know-about-2/
这篇关于Azure Web Job将文件写入网站目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!