title: Asp.Net - Offload processing to external application
body: <p>I have a asp.net website which processes requests using a 3rd party exe. Currently my workflow is</p>
  
  <ol>
  <li><p>User accesses website using any browser and fills out a form with job details </p></li>
  <li><p>Website calls a WCF self hosted windows service which is listening on a port </p></li>
  <li><p>Windows service launches 3rd party exe to process the job and returns the result to website </p></li>
  <li><p>Website displays the returned result to the user</p></li>
  </ol>
  
  <p>The above website was a prototype which now needs to be turned into a production ready deployment. I realize that the above architecture has many points that could break. For example, if the machine is powered off or if the windows service crashes and is no longer listening on the port, all current requests will stop processing. To make the architecture more robust, I am considering the following </p>
  
  <ol>
  <li><p>User accesses website using any browser and fills out a form with job details </p></li>
  <li><p>Website writes out the job details to a database </p></li>
  <li><p>Windows service which is polling the database every 10 seconds for a new job picks up the job and executes it using the 3rd party application. The results are written back to the database. </p></li>
  <li><p>Website which has now started polling the database, picks up the results and displays them to the user.</p></li>
  </ol>
  
  <p>The second architecture provides me with more logging capabilities and jobs can start again if they are in a queue. However it involves large amounts of polling which may not be scalable. Can anyone recommend a better architecture?</p>