Azure Web Job writes files in a website's directory

前端 未结 2 473
悲&欢浪女
悲&欢浪女 2020-12-16 15:53

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

相关标签:
2条回答
  • 2020-12-16 16:10

    try the following instead of putting a file location in the value parameter just put this as I show you here

    you can do it in the app.config file

    add key="app:TempFolderPath" value="~/temp/"/
    add key="app:TempReportDirectory" value="~/temp/"/
    

    the web job will automatically put in this location of

    D:\local\Temp\jobs\continuous\ImporterWebJob\yex3ad1c.3wo\~\temp\...your file...
    

    I hope this will not give you any errors.

    0 讨论(0)
  • 2020-12-16 16:22

    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%.

    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.

    Your WebJob will have access to the same paths/environment as your Web Site.

    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/

    0 讨论(0)
提交回复
热议问题