Q:

Is System.IO.File access allowed in IIS/Azure Cloud?

I have a WCF service that gets a CSV file via a WebClient. It works fine on my local machine. However when deployed on Azure cloud, it seems to fail silently. I am not able to find any indication in the log files that it failed.
I assume this code is failing because of this:
 public void DownloadStockPriceFromYahoo()
        {
            if (File.Exists(_path))
            {
                DateTime lastModified = System.IO.File.GetLastWriteTime(_path);
                if (lastModified.Date < DateTime.Today)
                {
                    File.Delete(_path);
                    using (WebClient Client = new WebClient())
                    {
                        Client.DownloadFile("http://finance.yahoo.com/d/quotes.csv?s=MSFT+INTC+GM&f=snl1d1ohg", _path);
                    }
                }
            }
            else
            {
                using (WebClient Client = new WebClient())
                {
                    Client.DownloadFile("http://finance.yahoo.com/d/quotes.csv?s=MSFT+INTC+GM&f=snl1d1ohg", _path);
                }
            }
        }

Could it be that IIS doesn't allow File access? What is the alternative?

A:

You need to be using either TEMP folder or Local Storage folder in order to download the file.  Azure protects the folder that you're running in from being written to.  Emulator will not catch it, but Azure runtime will.
What is the value of _path being set?
Here is how I would set the folder to come either from LocalStorage or a temp folder:
    var folder = Path.GetTempPath();
    folder = RoleEnvironment.IsAvailable
        ? RoleEnvironment.GetLocalResource("StockPriceDownloadFolder").RootPath
        : folder;

Now, in order to configure your StockPriceDownloadFolder as a Local Storage, check this link: http://msdn.microsoft.com/en-us/library/windowsazure/ee758708.aspx
You can also configure the folder via Visual Studio UI (inside the properties window of a Role)
Also, do keep in mind that this location should be a temporary location... when servers are running in a load-balanced environment, one server will not have access to storage of another server... plus Azure can (and will) reimage your servers at will (assuming you're using Cloud Services)... 

