How to let worker role app to access files from web role instance

247 Views Asked by At

we have a windows service , and now need to change to worker role application, but this service need to get some file from web application every time, as i know, web role and worker role are running in different instance, so my question is: how to let worker role application to access the file from web role instance.

1

There are 1 best solutions below

4
On

You could make use of either blob storage or azure file service for that purpose.

Since you're migrating an existing application, I would recommend going with azure file service. Basically what you will do is create a share and map that share as a network drive on both web role and worker role when the role starts. Web role will then write a file to this share using standard file API. To notify the worker role that a file is there to be processed, web role could write a message to a queue which is being polled by worker role. Upon receipt of the message, worker role will read the file and process that file.

You may find this blog post useful regarding azure file service: http://blogs.msdn.com/b/windowsazurestorage/archive/2014/05/12/introducing-microsoft-azure-file-service.aspx.