title: Web browser print from service running on windows 2012
body: <p>We have a automated printing service running as System account printing web urls.
  The idea is using <a href="http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&amp;l=EN-US&amp;k=k%28SYSTEM.WINDOWS.FORMS.WEBBROWSER%29;k%28TargetFrameworkMoniker-%22.NETFRAMEWORK,VERSION=V4.0%22%29;k%28DevLang-CSHARP%29&amp;rd=true" rel="nofollow noreferrer">WebBrowser</a> to load  page and call <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.print%28v=vs.100%29.aspx" rel="nofollow noreferrer">Print</a> upon it finished loading.</p>
  
  <p>This works fine on Server 2003 , 2008r2 etc but does not work on Server 2012 ONLY IF it was running as a service. running as a console application works fine.</p>
  
  <p>The problem:</p>
  
  <p>It would load web pages fine and would call Print() , Print() will return but nothing gets printed on the default printer: no print job at all.</p>
  
  <p>I thought it would be account problem so I tried to run service as the same logged on user but still does not work, if that user run application as console app then it would work fine. So default printer and user account get ruled out.</p>
  
  <p>I don't think it is a code problem (it must be though) as it works for older Windows versions running as service.</p>
  
  <p>It seems something fundamental got changed for a service process in server 2012.</p>
  
  <p><strong>Update １.</strong>　It may relates to <a href="https://stackoverflow.com/questions/174/how-do-i-print-an-html-document-from-a-web-service">How do I print an HTML document from a web service?</a></p>
  
  <p>However it works fine for me prior server 2012. </p>
  
  <p><strong>Update 2.</strong> It does not work even the whole print happens in a separate process, i.e. my service launches a process to do print, it does not work either. Everything works fine if I run same code in console mode. It is definitely not a threading problem but rather something deep in server 2012.</p>
  
  <p>Now the questions are:</p>
  
  <p>What is changed? Why it stopped working?</p>