user656822
user656822

Reputation: 1167

Deploy without code modification in Azure

Is there any way to deploy web application on azure cloud without modifying the Upload method that saves the data to disk?

In Upload method I save data on disk:

var imgPath = Url.Content(String.Format("~/Content/PersonImg/{0}", fileName));
String filePath = HostingEnvironment.MapPath(imgPath);

Upvotes: 0

Views: 85

Answers (2)

Gaurav Mantri
Gaurav Mantri

Reputation: 136196

If you're deploying your code in a Windows Azure Website, then the upload code should work though I have seen people using Server.MapPath instead of HostingEnvironment.MapPath. However if you deploy your code in a Windows Azure Cloud Service, then the code above will not work. In case of a cloud service, you would need to make use Local Storage.

Having said this, I think you should refrain from storing the files on the server itself. As mentioned in another answer, storage in VM is not persistent. Furthermore, in case of Windows Azure Websites, the amount of disk space you get is limited. As mentioned in the other answer, you should look at Windows Azure Blob Storage for storing these files.

Upvotes: 2

Gábor Domonkos
Gábor Domonkos

Reputation: 1111

If you want to deploy your web application to the Cloud you should use Azure Storage to store your files. The disk of the cloud service is not permanent.

Here is some help: http://www.windowsazure.com/en-us/documentation/services/storage/

Upvotes: 1

Related Questions