ASP.Net Core at AWS EBS - write permissions and .ebextensions

允我心安 提交于 2021-02-07 20:38:00

问题


We have deployed ASP.Net Core app on AWS EBS and have problem with writing files on it.

Access to the path C:\inetpub\AspNetCoreWebApps\app\App_Data\file.txt is denied

I added .ebextensions\[app_name].config but it did nothing

{
    "container_commands": {
        "01": {
            "command": "icacls \"C:/inetpub/AspNetCoreWebApps/app/App_Data\" /grant DefaultAppPool:(OI)(CI)"
        }
    }
}

I know that this is permission problem because when I RDP to machine and changed permission manually it solved problem. I would like to it during deploy using .ebextensions\[app_name].config


回答1:


.ebextensions\[app_name].config run before deploy and during deploy folder was recreated - that why it was not working. I fixed it by adding postInstall Power Shell script into aws-windows-deployment-manifest.json:

"scripts": {
      "postInstall": {
        "file": "SetupScripts/PostInstallSetup.ps1"
      }


来源:https://stackoverflow.com/questions/42766991/asp-net-core-at-aws-ebs-write-permissions-and-ebextensions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!