Can I write to file system on azure web site?

前端 未结 6 640
甜味超标
甜味超标 2020-11-27 06:18

Can I write to file system on azure Web Site? for example updating or installing plugins/themes in Wordpress from dashboard. AFAIK, it is not possible on Heroku so what abou

相关标签:
6条回答
  • 2020-11-27 06:36

    I offer to use a blobs container instead to store permanent content that must be persisted regardless of virtual machines re-initialization or upgrades.

    0 讨论(0)
  • 2020-11-27 06:41

    You can write to the HOME environment variable location (%HOME% / $HOME) on Azure App Services. You can use Kudu or the app service's console to cd into this directory and explore it.

    0 讨论(0)
  • 2020-11-27 06:43

    Surely it is possible to write on the file system of Azure Websites. However your write permissions are limited to the root folder of your app. So, if you use ASP.NET, you shall be able to write anywhere within the Server.MapPath("~/from_here_on"). Meaning you shall be able to perform read/write/delete operations on files which are located in the root folder of your app and below. If you use PHP, the root folder can be get from $_SERVER['DOCUMENT_ROOT'] environment variable.

    And a web application shall not need more privileges. For sure will not be able to write on the operating system folders.

    0 讨论(0)
  • 2020-11-27 06:43

    If you're asking about a C:\ drive or D:\ drive access on the Azure Website, the answer is no. You don't have access to the file system in that way on Azure websites. You do have access to the disk if it's a Web Role (Cloud services) or Virtual Machines.

    However, as you may have know already, you can use Wordpress admin tool itself to edit the plugin code.

    0 讨论(0)
  • 2020-11-27 06:45

    As far as I understand, you can write to the drive on an azure web role, but the problem is that a web role can have multiple instances so putting a file on whatever node you are connecting too doesn't put it on the other nodes and when that instance gets recycled it goes back to the original image of the web role so you would lose the file.

    However it is possible to share a drive across instances of Azure web role nodes at least according to this article, and then you can setup a virtual folder beneath the web site that points to this shared drive and use that for media storage.

    http://blogs.msdn.com/b/windowsazurestorage/archive/2011/04/16/using-smb-to-share-a-windows-azure-drive-among-multiple-role-instances.aspx

    I haven't tried it yet myself but came across this question while searching about how to do it.

    0 讨论(0)
  • 2020-11-27 06:53

    Just as an additional information if someone encounters a could not find a part of the path ... error while writing: make sure that the folder you are writing to gets deployed. In my case it was an empty temporary directory which got skipped during deployment.

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