Note that there are some explanatory texts on larger screens.

plurals
  1. POAutoStart/Pre-warm features not working in IIS 7.5 / WCF service
    primarykey
    data
    text
    <p>For testing the many headaches of IIS/WCF implementation from scratch, I built the HelloWorld service and client walked through (very nicely) <a href="http://www.codeproject.com/Articles/97204/Implementing-a-Basic-Hello-World-WCF-Service">here</a>. I added endpoints for net.tcp, and the service is working properly end-to-end for both bindings under <code>IIS 7.5</code> (on Windows 7) in its own <code>ApplicationPool</code> called HW.</p> <p>What I'm trying to get working is the announced AutoStart and Preload (or "pre-warm caching") features. I've followed the instructions laid out <a href="http://weblogs.asp.net/scottgu/archive/2009/09/15/auto-start-asp-net-applications-vs-2010-and-net-4-0-series.aspx">here</a> and <a href="http://developers.de/blogs/damir_dobric/archive/2009/10/11/iis-7-5-and-always-running-web-applications.aspx">here</a> (quite similar to one another, but always good to have a second opinion) very closely. Which means I</p> <p>1) Set the application pool <code>startMode</code>...</p> <pre><code>&lt;applicationPools&gt; &lt;!-- ... --&gt; &lt;add name="HW" managedRuntimeVersion="v4.0" startMode="AlwaysRunning" /&gt; &lt;/applicationPools&gt; </code></pre> <p>2) ...enabled <code>serviceAutoStart</code> and set a pointer to my <code>serviceAutoStartProvider</code></p> <pre><code>&lt;site name="HW" id="2"&gt; &lt;application path="/" applicationPool="HW" serviceAutoStartEnabled="true" serviceAutoStartProvider="PreWarmMyCache" /&gt; &lt;!-- ... --&gt; &lt;/site&gt; </code></pre> <p>3) ...and named said provider, with the <code>GetType().AssemblyQualifiedName</code> of the class listed in its entirety below</p> <pre><code>&lt;serviceAutoStartProviders&gt; &lt;add name="PreWarmMyCache" type="MyWCFServices.Preloader, HelloWorldServer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /&gt; &lt;/serviceAutoStartProviders&gt; </code></pre> <hr> <pre><code>using System; namespace MyWCFServices { public class Preloader : System.Web.Hosting.IProcessHostPreloadClient { public void Preload(string[] parameters) { System.IO.StreamWriter sw = new System.IO.StreamWriter(@"C:\temp\PreloadTest.txt"); sw.WriteLine("Preload executed {0:G}", DateTime.Now); sw.Close(); } } } </code></pre> <p>Alas, all this manual configuration, plus a couple <code>iisreset</code> calls, and I get nothing. No <code>w3wp.exe</code> process firing up in Task Manager (though I get it if I launch the HelloWorldClient), no text file, and above all, no satisfaction.</p> <p>There is a frustratingly scant amount of discussion about this feature, either on SO or the wider web, and the few similar questions here got little attention, all of which rings an alarm bell or two. Perhaps needlessly though--any experts out there who have been down this very road a time or two care to chime in? (Happy to offer up the entire solution if you can suggest a good place to host it.)</p> <hr> <p><strong>EDIT</strong>: I tried resetting that path in the <code>Preload</code> method to the relative <code>App_Data</code> folder (another SO answer suggested that), didn't matter. Also, I learned the <code>w3wp.exe</code> process fires on a simple browse to the localhost. The process consumes an impressive 17MB of memory to serve up its single tiny OperationContract, while for the price offering zero Preload value. 17MB of ColdDeadCache.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload