How do you access local files from within a windows azure web service? I tried routing the complete path to the file within VS but it says that access is denied. I was hoping there was something similar to Server.MapPath() in ASP.NET but I haven't come accross anything like that yet. Also I am running VS in Administrator mode. Any ideas?

NOTE: I am using a WCF Service (A cloud project in VS)

Accepted Answer

Things are different in Azure. Basically you need to indicate and set up local storage usage in the service definition file for your role. There is Local Storage section in the role properties. Once setup, you can access the local storage in your code by calling RoleEnvironment.GetLocalResource and passing in the local storage name. You can then read from and write to that local storage. Below are some blogposts on the topic.

Written by Mehmet Aras
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki