title: How do I host an Azure worker role locally/on premise?
body: <p><em>Some background....</em></p>
  
  <p>We're venturing into Azure for the first time and are trying to do it in baby steps. For now, our first apps are going to be worker roles monitoring queues to process requests (such as sending an email or performing some screen scraping) and we'll just insert into the queues from our on-premise MVC app and WCF services. We'll later move the MVC app and WCF services to Azure.</p>
  
  <p>Our development workflow essentially goes like this (somewhat modified in unimportant ways):</p>
  
  <ol>
  <li>Develop locally and on some shared servers. Check into source control.</li>
  <li>Every 15 minutes, build server builds and deploys to a "development" environment (doubles as CI and covers in case we need to hit a "development" environment other than local)</li>
  <li>Technical testers manually trigger build server to deploy the last-successful "Dev" build to the Test environment (or alternately, the previously-deployed Test build, including/excluding database).</li>
  <li>Technical testers and business testers manually trigger build server to deploy the last-successful "Test" build (or alternately, the previously-deployed Test build, including/excluding database) to the QA environment.</li>
  <li>At some point we merge the changeset that QA approves for deployment.</li>
  <li>Later our production build server deploys this version to staging and then later to our production environments (we host it N times in parallel/independent environments).</li>
  </ol>
  
  <p>As you can tell, we have a number of internally-hosted versions of our app for internal support people to hit against prior to reaching production. I would like for these to have a reasonably low-level of dependence upon Azure. I don't need to complete sever dependence so we'll continue to use Azure Queues and perhaps some other mechanisms just because they're easy to continue using, but we don't want to have our build server to have to deploy to Azure for every one of these environments (and alternatively pay for all that hosting).</p>
  
  <p><strong>So how can we reasonably host our Worker Roles on-premise in a way where we're actually testing the code that gets deployed to Azure?</strong></p>
  
  <p>One option that's been suggested is that we create the worker role as a wrapper/facade and do all the real work inside a class library, which was our plan. However, the follow-up to allow us to "host" this would be to create a second wrapper/facade application that performs the same work as the worker role, just in a way where we can run it as a scheduled task or a windows server. Ultimately, I don't like this option because an entire project is never tested until it hits staging.</p>
  
  <p><strong>Is it possible to do something similar where we create a second wrapper/facade application that instead of calling the class library that it actually references and calls the <code>Run()</code> function in the worker role?</strong></p>