I'm running 2 azure instances on my cloudservice that is hosting a website.
I upload a file to a folder and it's saved in one of the instances. When I try to load it, if azure chooses the wrong instance, it doesn't find the file. What options do I have to solve this?
I thought in saving the files in a blob storage but if I could keep it this way it would save me some time.
As you mentioned in your question, you should save it in blob storage. There are few reasons for that:
stateless by nature
. What that means is that anything you do on that VM (like saving files etc.) are gone once the VM goes down.Blob storage, on the other hand is persistent storage and is accessible via simple http protocol. So when a user uploads a file, you save it in blob storage. When user requests it, you just serve the blob from blob storage.
UPDATE - BASED ON COMMENTS BELOW
Regarding your 1st comment, You can still use blob storage. What you could do is create a blob container to hold temporary files and once the user has completed all the steps, you could move them to another container (let's call it permanent container). For copying blobs from one container to another you don't even have to download the blobs to your VM. Windows Azure supports server side async copy which copies the blob from one container to another server side.
Regarding your 2nd comment, I don't think you can change the load balancing policy. There's something called
Application Request Routing (ARR)
which does implement sticky sessions but unfortunately I'm not familiar with it. You may want to look into it.