How can I set folder permissions for elastic beanstalk windows application?
This is already possible since April 2013, see also here: Basically the steps you need to perform are the following:
- Create a folder called .ebextensions in the top-level of your project through the solution explorer
- Add in this folder your configuration file e.g myapp.config (replace myapp with your Elastic Beanstalk's app name)
- Add the code displayed underneath to this configuration file you just created. Replace
MyApp
with your project name (not solution name) displayed in Visual Studio All set!! Be sure there's a file within App_Data otherwise Visual Studio won't publish it.
{ "containercommands": { "01-changeperm": { "command": "icacls \"C:/inetpub/wwwroot/MyApp_deploy/App_Data\" /grant DefaultAppPool:(OI)(CI)" } }}
To give write permission to your DefaultAppPool you can
create an .ebextensions folder
create a config file and place it in your .ebextensions folder
This will change permission to your wwwroot folder
container_commands: 01-changeperm : command : 'icacls "C:\\inetpub\\wwwroot" /grant "IIS APPPOOL\DefaultAppPool:(OI)(CI)F"'
I had the same problem (unable to write to a file in the App_Data
folder of my web application on Elastic Beanstalk).
In my case it was sufficient to create a dummy file in the App_Data
folder in my Visual Studio project. When I did this, the App_Data
folder was created during deployment with permissions that allow the web application to write to it.
No need for .ebextensions
to change folder permissions.