Search code examples
iisfileshare

Azure File Storage - IIS - ASP.net application


I have a legacy asp.net application (EG:www.mycompany.com). There are around 10 folders inside that application and one of them has lot of images (reads/write) (EG www.mycompany.com/images/1.jpg) around 3 TB.

We are migrating this application to Azure VM. What we trying to do here is, keep all the 9 directories of that application inside the VM disk and move the images folder alone to Azure Storage.

So we created an Azure file share, created an local account with the same credentials as Azure Storage. Gave the local account IIS_USR group and then run the web application under this user.

We created a virutal directory called "images" inside the web application and linked that to say "\XXXX.file.core.windows.net\images".

The problem i am facing now is, we are able to read the file and show it in the web browser, but we are unable to upload a new image. When trying to upload an image from the web browser (thru the web application), it actually creates a folder called "images", because the code behind it uses server.mappath.

Is there any other alternative implementation without an code change.


Solution

  • We ended up creating a symbolic link for the images folder, that points to azure storage. Created a local vm user with same credentials as the azure storage account and ran IIS with that local user.

    Everything worked fine.