Search code examples
asp.netazure-web-app-servicepaasazure-file-share

Map azure files path to Azure App Service and access with Path


I'm working on a project to move a dotnet application from Virtual Machine to App Service.

The code has been moved already using deployment center and the pages loads up. But in the backend there are alot of file transfers happening where the folder paths are like D:/AppRoot/FolderA etc.

I have created a storage account and mapped the exact folder structure there as it's in the VM. From App Service configuration I have mounted the Azure Files Share. So it's now /mounts/AppRoot which contains the folders.

Now is it possible for me to direct the application to use the mounted path by updating the folder paths in the web.config file from anything that has D:/AppRoot/ to /mounts/AppRoot ?

Any advice on this will be a great help.

Tried playing around with the syntaxes and path directories. Nothing worked.

I tried googling around, Checking alot of Forums but no one seems to have suggested a final solution for this.


Solution

  • Yes, you can update the folder paths in the web.config file to use the mounted path.

    For this, you need to replace the path D:/AppRoot/ with /mounts/AppRoot/ in the web.config file. And this allows the application to access the files from the mounted path.

    enter image description here

    • Open web.config file in an editor. You can access the web.config file from the App Service Editor in the Azure portal.

      enter image description here

    • Search for the folder paths that start with D:/AppRoot/. You can use the search function in the text editor to find all instances of the folder paths.

    enter image description here

    • Replace the folder paths with /mounts/AppRoot/. And save the web.config file.
    <appSettings>  
        <add key="FolderPath" value="/mounts/AppRoot/FolderA" />
      </appSettings>
    

    Now the application be able to access the files from the mounted path.

    For more information refer to Mount Azure file share on Windows and Configuring apps.