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.
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.
Related
The web app already running on .NET Core 3.1 LTS with IIS (windows server 2019)
Recently, I deployed as an Azure Web App Service but I encountered a file write error.
The application trying to create a new file for some business requirement.
Error message; System.IO.IOException: Read-only file system
Has anyone encountered this problem on Azure Linux Web App?
Solved: The Azure Linux Web App Service doesn't support directly file uploading to a regular folder under the wwwRoot. If you can running on the linux web app service, you need to use blob / storage etc..
Azure web app recommends that the wwwroot folder has read and write permissions. Whether it's Linux or Windows, it's the same.
In addition, it is not recommended to put the content of file operations in the project directory. For example, excel files generated under a certain business or uploaded image files in the deployment file. And the files are recommended to be stored in azure storage.
From the information which you have provided we can understand that there is any issue in creating a file in a specific directory where you don’t have access to it.
Refer to this SO thread where we got the insights to disable read-only mode, thanks to MarkXA.
Make sure that you have provided correct path whether it is any storage account or local storage where you are getting files. Also, if possible, elaborate your questions with full error trace, path you are using to access.
I've developed a .NET Core Website and published it to Azure. Under the wwwroot folder, I have a home folder and within that folder I have a home.txt file.
I want a none-developer to be able to ftp their own copy of home.txt to my site and overwrite the one that is there. They won't be doing this very often, but they will be doing it many times.
What is the easiest way for me to set this up for them?
As far as I know, it is not possible to provide FTP access to a single file. So you probably have to write a REST endpoint that allows you to upload a file to your wwwroot folder and add an upload form to your web site for your "non-developer" users.
You could also create a storage account with multiple containers (one for each "non-developer"). Then you create a SAS (shared access signature) for each container and give it to your users. They can then upload their files using e. g. Azure Storage Explorer. To get the files into your website wwwwroot folder, you can write an Azure Function that gets triggered by azure function blob storage events.
In azure file storage, I have mounted a drive to Azure File storage location.
This mounted drive has images which need to be referred by all web apps and app services. How do I created a virtual Directory using mounted drive? So that I can use the virtual directory to refer the images.
example : \\{filestoragename}.blob.core.windows.net\images\ mounted to the Drive Z:
How to create a virtual directory called "images" pointing to Z: in my Web Application. So image will be referred using the www.domainname.com/images/demo.jpg.
Web App has "Virtual applications and directories" section. But it throws the error as If I try to refer Z: Physical path.
I see, seems you are using code publish web app (common windows Web Apps) instead of Linux Web Apps or Windows Containers Web Apps (docker/container publish) .
If you use Linux Web Apps or Windows Containers Web Apps , you can mount Azure storage related resources here directly :
However, if you are using common windows Web Apps, the config menu looks like below :
common windows web apps can not mount Azure storage related resources directly.
The only way to access Azure storage resources here is using Azure storage REST API.
We have got an approach that login to the Virtual Machine where we hosted the web application , Open the IIS and create a Virtual Directory which is referring the Blob storage location.
Another approach is ....
We have decided to Configure a Azure custom domain for accessing blob data in your Azure storage account, like www.media.domainname.com.
This approach helps us to refer static images placed in one location.
No need create virtual directory for each web site.
I have deployed my web app and the cloud service on windows azure. Web app saved some of the image files on its own directory lets say on root of the website there is folder name "Content" and web app save the image files on this folder. is there a way a cloud service can access files inside that folder? cloud service is separate project and hence has its own url and hosted on windows azure portal.
AFAIK, it is not possible to share files stored in a web app with a cloud service. What you should do instead is save the files in Blob Storage. That way both Web App and Cloud service can have access to the files.
Another option you have is Azure File Services, you will have the chance to used as a network shared location.
take a look at this here:
https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-files/
i am new to the windows azure web application deployment.
i developed mvc web application and publish to the windows azure cloud platform.
i have one folder name Messages, that contains the images that i have upload via application. now after user upload images in web app once the app is published on cloud.
next time when i republish the application to the cloud
that "Messages" folder contents (images) are removed.
can you please help me, how to resolve this?
Regards, Brijesh vaidya
This is the expected behavior. Anytime you redeploy your application, new VMs are created for your application. You should not store anything that you want to persist on VM. Instead store them in blob storage. So in your case, you should upload the image and once the image is uploaded, transfer it to blob storage. You may want to check out this hands-on-lab in Azure training kit: https://github.com/WindowsAzure-TrainingKit/HOL-IntroToCloudServices-VS2012