<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.iis.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>rick.james</title><link>http://blogs.iis.net/rickjames/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Debug Build: 20510.895)</generator><item><title>IIS 7 C++ Module API Sample: Controlling http.sys caching</title><link>http://blogs.iis.net/rickjames/archive/2007/11/20/iis-7-c-module-api-sample-controlling-http-sys-caching.aspx</link><pubDate>Tue, 20 Nov 2007 19:29:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:2017094</guid><dc:creator>rickjames</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/rickjames/rsscomments.aspx?PostID=2017094</wfw:commentRss><comments>http://blogs.iis.net/rickjames/archive/2007/11/20/iis-7-c-module-api-sample-controlling-http-sys-caching.aspx#comments</comments><description>&lt;H1&gt;IIS 7 C++ Module API Sample: Controlling http.sys caching&lt;/H1&gt;
&lt;H3&gt;Introduction&lt;/H3&gt;
&lt;P&gt;In my &lt;A href="http://blogs.iis.net/rickjames/archive/2007/11/01/fun-with-http-sys-caching.aspx" mce_href="http://blogs.iis.net/rickjames/archive/2007/11/01/fun-with-http-sys-caching.aspx"&gt;previous&lt;/A&gt; post we saw that http.sys caching can be very useful for high traffic (gigabits/sec) sites. In this post we create a sample module that allows configuring which URLs can enter the cache.&lt;/P&gt;
&lt;H3&gt;Code&lt;/H3&gt;There is very little non-template, IIS-specific, code in this module. In fact here is everything that is important: 
&lt;BLOCKQUOTE style="BORDER-RIGHT: #000 1px dotted; PADDING-RIGHT: 1ex; BORDER-TOP: #000 1px dotted; PADDING-LEFT: 1ex; PADDING-BOTTOM: 1ex; BORDER-LEFT: #000 1px dotted; PADDING-TOP: 1ex; BORDER-BOTTOM: #000 1px dotted; FONT-STYLE: normal"&gt;&lt;PRE&gt;REQUEST_NOTIFICATION_STATUS
MODULE::OnSendResponse(
    IHttpContext*           pContext,
    ISendResponseProvider*  pProvider
)
{
    if( !pProvider-&amp;gt;GetHeadersBeingSent( ) )
    {
        //
        // headers not being sent, not first send response notification, nothing to do
        //
        goto Finished;
    }

    if( !g_pUrlHash-&amp;gt;Exists( pContext-&amp;gt;GetScriptName( ) ) )
    {
        //
        // not a pre-determined "hot" url, no caching..
        //
        IHttpResponse* pResponse = pContext-&amp;gt;GetResponse( );
        pResponse-&amp;gt;DisableKernelCache( 123 );
    }

Finished:

    return RQ_NOTIFICATION_CONTINUE;
}
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;Important points: 
&lt;UL&gt;
&lt;LI&gt;RQ_SEND_RESPONSE is a "non-deterministic" notification that can fire multiple times (e.g. whenever someone calls IHttpResponse::Flush). To determine the first time we're being notified, the module checks ISendResponseProvider::GetHeadersBeingSent. This is only true on the first notification for the request.&lt;/LI&gt;
&lt;LI&gt;IHttpContext::GetScriptName is often the URL you want to compare to. It has been "sanitized" and had PATH_INFO removed.&lt;/LI&gt;
&lt;LI&gt;IHttpResponse::DisableKernelCache trumps any cache policy configured with IHttpResponse::GetRawHttpResponse()-&amp;gt;...&lt;/LI&gt;&lt;/UL&gt;
&lt;H3&gt;Setup&lt;/H3&gt;As mentioned, there are many caches and caching algorithms in IIS. To simplify the testing of this module I: 
&lt;UL&gt;
&lt;LI&gt;disabled my file cache module (simply removed it from the pipline - "appcmd uninstall module FileCacheModule").&lt;/LI&gt;
&lt;LI&gt;disabled the "hotness" detection algorithm in iiscore ("appcmd set config -section:serverRuntime -frequentHitThreshold:1")&lt;/LI&gt;&lt;/UL&gt;
&lt;H3&gt;Test&lt;/H3&gt;
&lt;P&gt;This time I'm using a newer dual-core machine with 1GB ram and running the perf client locally. There are 4000x184kb "hot" files, and 4000x184kb "cold" files. Total = 8000x184kb = 1.4GB. Hot files are hit 32x more frequently than cold files. For the Cacheit test, I installed the module and only gave it the full list of 4000 hot URLs.&lt;/P&gt;
&lt;TABLE class="" border=1&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class=""&gt;Test&lt;/TD&gt;
&lt;TD class=""&gt;Req/s&lt;/TD&gt;
&lt;TD class="" colSpan=2&gt;Cache Content&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=""&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class=""&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class=""&gt;Hot&lt;/TD&gt;
&lt;TD class=""&gt;Cold&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=""&gt;Baseline&lt;/TD&gt;
&lt;TD class=""&gt;770&lt;/TD&gt;
&lt;TD class=""&gt;3994&lt;/TD&gt;
&lt;TD class=""&gt;765&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=""&gt;Cacheit&lt;/TD&gt;
&lt;TD class=""&gt;833 (+8%)&lt;/TD&gt;
&lt;TD class=""&gt;4001&lt;/TD&gt;
&lt;TD class=""&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;Request/sec came from wcat's log. Cache contents was determined by running "netsh http show cachestate &amp;gt; out.txt" and then "findstr /i hot out.txt" and "findstr /i cold out.txt".&lt;/P&gt;&lt;!--
        &lt;p&gt;This unimpressive result stems from the fact that the entire hot set (700mb) can fit into memory. So regardless of how "smart" the caching algorithm is, provided the entire hot set fits results will be about the same. The next test uses 10,000 hot and 10,000 cold files. Meaning the hot set is now 1.75GB and so definitely will not fit into RAM. Cacheit is still configured to only cache the first 4,000 hot URLs. Not surprisingly, since we're far more disk-bound, things slowed dramatically overall.
        &lt;table border="1"&gt;
            &lt;tr&gt;
                &lt;td&gt;Test&lt;/td&gt;
                &lt;td&gt;Req/s&lt;/td&gt;
                &lt;td colspan="2"&gt;Cache Content&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;&amp;nbsp;&lt;/td&gt;
                &lt;td&gt;&amp;nbsp;&lt;/td&gt;
                &lt;td&gt;Hot&lt;/td&gt;
                &lt;td&gt;Cold&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;Baseline&lt;/td&gt;
                &lt;td&gt;40&lt;/td&gt;
                &lt;td&gt;4645&lt;/td&gt;
                &lt;td&gt;234&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;Cacheit-4000&lt;/td&gt;
                &lt;td&gt;62 (+55%)&lt;/td&gt;
                &lt;td&gt;2353&lt;/td&gt;
                &lt;td&gt;3&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;Default Settings&lt;/td&gt;
                &lt;td&gt;58 (+45%)&lt;/td&gt;
                &lt;td&gt;381&lt;/td&gt;
                &lt;td&gt;0&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;Defaults + Cacheit-2000&lt;/td&gt;
                &lt;td&gt;88 (+120%)&lt;/td&gt;
                &lt;td&gt;183&lt;/td&gt;
                &lt;td&gt;0&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;nofile,nouri,nocacheit,nohot&lt;/td&gt;
                &lt;td&gt;69 (+%)&lt;/td&gt;
                &lt;td&gt;&lt;/td&gt;
                &lt;td&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;baseline again&lt;/td&gt;
                &lt;td&gt;44 (+%)&lt;/td&gt;
                &lt;td&gt;4572&lt;/td&gt;
                &lt;td&gt;243&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;Cacheit-2000&lt;/td&gt;
                &lt;td&gt;64(+%)&lt;/td&gt;
                &lt;td&gt;1366&lt;/td&gt;
                &lt;td&gt;0&lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
        It is also interesting to note how less caching is leading to better performance here
        &lt;/p&gt;
        --&gt;
&lt;H3&gt;Conclusion&lt;/H3&gt;The optimistic conclusion is that we've learnt about a new way of using the module APIs as well as tried out a common thought experiment (what would happen if my cache new exactly what to cache). Another conclusion is that, with the exact scenario under consideration, there are probably very very few cases where this would be useful. &lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=2017094" width="1" height="1"&gt;</description><enclosure url="http://blogs.iis.net/rickjames/attachment/2017094.ashx" length="94728" type="application/x-zip-compressed" /></item><item><title>Fun with http.sys Caching</title><link>http://blogs.iis.net/rickjames/archive/2007/11/01/fun-with-http-sys-caching.aspx</link><pubDate>Thu, 01 Nov 2007 16:40:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1985420</guid><dc:creator>rickjames</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/rickjames/rsscomments.aspx?PostID=1985420</wfw:commentRss><comments>http://blogs.iis.net/rickjames/archive/2007/11/01/fun-with-http-sys-caching.aspx#comments</comments><description>&lt;H2&gt;Introduction&lt;/H2&gt;
&lt;P&gt;There are many caches available to web applications. Today I will play with the http.sys URI cache. It is a simple, fast, kernel-mode cache. &lt;IMG src="http://wallpaper.iis7.org/rickj/arch.png" mce_src="http://wallpaper.iis7.org/rickj/arch.png"&gt; 
&lt;H2&gt;How it Works&lt;/H2&gt;
&lt;P&gt;First IIS must decide if the response can be stored in the http.sys' cache (devs: See &lt;A href="http://search.live.com/results.aspx?q=HttpSendHttpResponse" mce_href="http://search.live.com/results.aspx?q=HttpSendHttpResponse"&gt;HttpSendHttpResponse&lt;/A&gt;'s pCachePolicy argument). There are about &lt;A href="http://support.microsoft.com/kb/817445" mce_href="http://support.microsoft.com/kb/817445"&gt;twenty&lt;/A&gt; reasons for IIS to decide something should not get in the cache (because of the cache's simple design). To find out why a specific request is not being cached, enable "Failed Request Tracing" and look for the HTTPSYS_CACHEABLE event's reason field.&lt;/P&gt;
&lt;P&gt;Assuming the response meets the approx. twenty conditions, then IIS needs to decide if the item is "hot". Hotness can be configured using system.webServer/serverRuntime@frequentHitThreshold and frequentHitTimePeriod. A request is "hot" if it has been hit frequentHitThreshold times in the last frequentHitTimePeriod seconds. IIS only marks "hot" requests for caching.&lt;/P&gt;
&lt;P&gt;Once IIS tells http.sys to cache, http.sys than applies some additional checks (&lt;A href="http://support.microsoft.com/kb/820129" mce_href="http://support.microsoft.com/kb/820129"&gt;settings&lt;/A&gt;), including a size limit, that defaults to 256kb. http.sys clears out entries that have not been accessed in UriScavengerPeriod (2 minutes by default).&lt;/P&gt;
&lt;H2&gt;Experiment&lt;/H2&gt;
&lt;P&gt;Using &lt;A href="http://www.iis.net/go/1466" mce_href="http://www.iis.net/go/1466"&gt;wcat&lt;/A&gt;, the attached wcat script and the attach content-creation script, I produced these results (using an old 1x dual-core machine): 
&lt;TABLE class="" border=1&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class=""&gt;Size&lt;/TD&gt;
&lt;TD class="" colSpan=2&gt;Cache Disabled&lt;/TD&gt;
&lt;TD class="" colSpan=2&gt;Cache Enabled&lt;/TD&gt;
&lt;TD class="" colSpan=2&gt;Percent Difference&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=""&gt;&lt;/TD&gt;
&lt;TD class=""&gt;req/s&lt;/TD&gt;
&lt;TD class=""&gt;CPU&lt;/TD&gt;
&lt;TD class=""&gt;req/s&lt;/TD&gt;
&lt;TD class=""&gt;CPU&lt;/TD&gt;
&lt;TD class=""&gt;req/s&lt;/TD&gt;
&lt;TD class=""&gt;CPU&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=""&gt;1,000 x 1kb&lt;/TD&gt;
&lt;TD class=""&gt;4960&lt;/TD&gt;
&lt;TD class=""&gt;100&lt;/TD&gt;
&lt;TD class=""&gt;38,041&lt;/TD&gt;
&lt;TD class=""&gt;100&lt;/TD&gt;
&lt;TD class=""&gt;+667%&lt;/TD&gt;
&lt;TD class=""&gt;0%&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=""&gt;1,000 x 100kb&lt;/TD&gt;
&lt;TD class=""&gt;2383&lt;/TD&gt;
&lt;TD class=""&gt;100&lt;/TD&gt;
&lt;TD class=""&gt;3,514&lt;/TD&gt;
&lt;TD class=""&gt;50&lt;/TD&gt;
&lt;TD class=""&gt;+47%&lt;/TD&gt;
&lt;TD class=""&gt;-50%&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=""&gt;100 x 10mb&lt;/TD&gt;
&lt;TD class=""&gt;35.72&lt;/TD&gt;
&lt;TD class=""&gt;81&lt;/TD&gt;
&lt;TD class=""&gt;35.5&lt;/TD&gt;
&lt;TD class=""&gt;52&lt;/TD&gt;
&lt;TD class=""&gt;-1%&lt;/TD&gt;
&lt;TD class=""&gt;-29%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;Note: Generally it's a good idea to get CPU usage=100% in perf tests, but in this case I ran out of NICs at 3 Gigabits/sec&lt;/P&gt;
&lt;H2&gt;Summary&lt;/H2&gt;
&lt;UL&gt;
&lt;LI&gt;If you're serving megabytes/sec of static files, then you'll probably see some substantial performance improvements from http.sys caching.&lt;/LI&gt;
&lt;LI&gt;Sometimes &lt;A href="http://blogs.iis.net/bills/archive/2007/05/02/iis7-output-caching-for-dynamic-content-dramatically-speed-up-your-asp-and-php-applications.aspx" mce_href="http://blogs.iis.net/bills/archive/2007/05/02/iis7-output-caching-for-dynamic-content-dramatically-speed-up-your-asp-and-php-applications.aspx"&gt;IIS 7 Output Caching&lt;/A&gt; allows you to put dynamically generated responses in http.sys' cache.&lt;/LI&gt;&lt;/UL&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=1985420" width="1" height="1"&gt;</description><enclosure url="http://blogs.iis.net/rickjames/attachment/1985420.ashx" length="9737" type="application/x-zip-compressed" /></item><item><title>FastCGI: Debugging "The FastCGI process exited unexpectedly"</title><link>http://blogs.iis.net/rickjames/archive/2007/10/16/fastcgi-debugging-quot-the-fastcgi-process-exited-unexpectedly-quot.aspx</link><pubDate>Tue, 16 Oct 2007 15:37:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1958622</guid><dc:creator>rickjames</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/rickjames/rsscomments.aspx?PostID=1958622</wfw:commentRss><comments>http://blogs.iis.net/rickjames/archive/2007/10/16/fastcgi-debugging-quot-the-fastcgi-process-exited-unexpectedly-quot.aspx#comments</comments><description>&lt;H1&gt;FastCGI: Debugging "The FastCGI process exited unexpectedly"&lt;/H1&gt;&lt;I&gt;Update 17-Oct: Added .lines, fixed some spelling mistakes, added pageheap&lt;/I&gt; Here is the sequence of events for two back-to-back FastCGI requests to a freshly started worker process: 
&lt;OL&gt;
&lt;LI&gt;Request 1: HTTP GET /hello.php&lt;/LI&gt;
&lt;LI&gt;IIS (iiscore.dll) looks up handler in system.webServer/handlers, find FastCGI module&lt;/LI&gt;
&lt;LI&gt;The FastCGI module (iisfcgi.dll) looks up handlers@scriptProcessor in fastCgi/applications&lt;/LI&gt;
&lt;LI&gt;The FastCGI module spawns a new FastCGI process&lt;/LI&gt;
&lt;LI&gt;The module then starts communicating with the process, according to the FastCGI protocol&lt;/LI&gt;
&lt;LI&gt;The FastCGI process generates and returns a response&lt;/LI&gt;
&lt;LI&gt;Request 2: HTTP GET /hello.php&lt;/LI&gt;
&lt;LI&gt;(same as above, except request 1's process is re-used)&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;As you can see there are many places where the FastCGI module expects to have a FastCGI process to communicate with. If the FastCGI process disappears at any of these steps, the "The FastCGI process exited unexpectedly" error occurs. If this happens frequently &lt;A href="http://blogs.iis.net/rickjames/archive/2007/10/12/fastcgi-rapid-failure-protection.aspx" mce_href="http://blogs.iis.net/rickjames/archive/2007/10/12/fastcgi-rapid-failure-protection.aspx"&gt;Rapid Failure Protection&lt;/A&gt; may be enabled. &lt;/P&gt;
&lt;P&gt;Here are some common causes for this error: 
&lt;UL&gt;
&lt;LI&gt;The FastCGI process calls some sort of &lt;A href="http://search.live.com/results.aspx?q=exitprocess" mce_href="http://search.live.com/results.aspx?q=exitprocess"&gt;ExitProcess&lt;/A&gt; API, e.g. the C exit() function&lt;/LI&gt;
&lt;LI&gt;An unhandled exception occurs, e.g. &lt;A href="http://search.live.com/results.aspx?q=access+violation" mce_href="http://search.live.com/results.aspx?q=access+violation"&gt;Access Violation&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;ExitProcess: 
&lt;UL&gt;
&lt;LI&gt;If the FastCGI is a script interpreter, the scripting language may support some sort of ExitProcess function and the script may call it. (though PHP's exit() function does not seem to exit the process)&lt;/LI&gt;
&lt;LI&gt;FastCGI processes often voluntarily exit after performing a certain number of requests. (e.g. PHP 5.2.1 does so at about 250 and can be &lt;A href="http://search.live.com/results.aspx?q=PHP_FCGI_MAX_REQUESTS" mce_href="http://search.live.com/results.aspx?q=PHP_FCGI_MAX_REQUESTS"&gt;configured&lt;/A&gt;) If the FastCGI module is expecting (fastCgi/application@instanceMaxRequests) the FastCGI process to perform more requests then this can also be a source of this error. This error can only happen in the time between when the next request arrives and the module detects the process' exit. This happens most often on busy servers, where requests are queuing for a FastCGI process.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Access Violations are more difficult to debug. The first step is to create a simple repro, here are repros sorted from simplest to most challenging: 
&lt;UL&gt;
&lt;LI&gt;Command line, without FastCGI. (e.g. \php\php.exe \inetpub\wwwroot\hello.php)&lt;/LI&gt;
&lt;LI&gt;Command line, with a web environment. (e.g. Ruby's Webrick, or my &lt;A href="http://blogs.iis.net/rickjames/archive/2007/02/04/fake-fastcgi-web-server.aspx" mce_href="http://blogs.iis.net/rickjames/archive/2007/02/04/fake-fastcgi-web-server.aspx"&gt;fake FastCGI server&lt;/A&gt;)&lt;/LI&gt;
&lt;LI&gt;Single HTTP request. (e.g. recycle AppPool, GET /hello.php)&lt;/LI&gt;
&lt;LI&gt;Only under load. (e.g. Only when &lt;A href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;i=1466&amp;amp;g=6" mce_href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;amp;i=1466&amp;amp;g=6"&gt;wcat&lt;/A&gt; is hitting the site)&lt;/LI&gt;
&lt;LI&gt;Randomly. (e.g. Only in production)&lt;/LI&gt;&lt;/UL&gt;Once you have the simplest script with the simplest repro, you need to debug it. Download &lt;A href="http://search.live.com/results.aspx?q=debugging+tools+for+windows" mce_href="http://search.live.com/results.aspx?q=debugging+tools+for+windows"&gt;Windbg&lt;/A&gt; or &lt;A href="http://search.live.com/results.aspx?q=iis+debug+toolkit" mce_href="http://search.live.com/results.aspx?q=iis+debug+toolkit"&gt;the IIS debug toolkit&lt;/A&gt;. The rest of this post discusses Windbg debugging, though the debug toolkit is often simpler and easier. 
&lt;OL&gt;
&lt;LI&gt;
&lt;P&gt;Attach the debugger: 
&lt;UL&gt;
&lt;LI&gt;For command-line failures, prefix the debugger onto the command. (e.g. c:\debuggers\ntsd -g -G \php\php.exe \inetpub\wwwroot\hello.php)&lt;/LI&gt;
&lt;LI&gt;For AppPool debugging, you'll need to attach after starting the AppPool, e.g. 
&lt;BLOCKQUOTE style="BORDER-RIGHT: #000 1px dotted; PADDING-RIGHT: 1ex; BORDER-TOP: #000 1px dotted; PADDING-LEFT: 1ex; PADDING-BOTTOM: 1ex; BORDER-LEFT: #000 1px dotted; PADDING-TOP: 1ex; BORDER-BOTTOM: #000 1px dotted; FONT-STYLE: normal"&gt;&lt;PRE&gt;        D:\&amp;gt;net start w3svc
        The World Wide Web Publishing Service service is starting.
        The World Wide Web Publishing Service service was started successfully.


        D:\&amp;gt;start http://localhost/dne

        D:\&amp;gt;\Windows\system32\inetsrv\appcmd list wps
        WP "&lt;FONT style="COLOR: red"&gt;4012&lt;/FONT&gt;" (applicationPool:DefaultAppPool)

        D:\&amp;gt;c:\debuggers\ntsd -o -g -G -p &lt;FONT style="COLOR: red"&gt;4012&lt;/FONT&gt;
        &lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;
&lt;LI&gt;Reproduce the Access Violation, you should see something like this in the debugger: 
&lt;BLOCKQUOTE style="BORDER-RIGHT: #000 1px dotted; PADDING-RIGHT: 1ex; BORDER-TOP: #000 1px dotted; PADDING-LEFT: 1ex; PADDING-BOTTOM: 1ex; BORDER-LEFT: #000 1px dotted; PADDING-TOP: 1ex; BORDER-BOTTOM: #000 1px dotted; FONT-STYLE: normal"&gt;&lt;PRE&gt;Executable search path is:
ModLoad: 00370000 00374000   av.exe
ModLoad: 77380000 774a6000   ntdll.dll
ModLoad: 76a80000 76b5b000   D:\Windows\system32\kernel32.dll
ModLoad: 75eb0000 75f5a000   D:\Windows\system32\msvcrt.dll
&lt;FONT style="COLOR: red"&gt;(ce4.d30): Access violation - code c0000005 (first chance)&lt;/FONT&gt;
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000000 ebx=00000000 ecx=00372374 edx=00000000 esi=00000001 edi=00372374
eip=00371190 esp=0014fe24 ebp=0014fe28 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010246
*** ERROR: Module load completed but symbols could not be loaded for av.exe
av+0x1190:
00371190 c700adbaadba    mov     dword ptr [eax],0BAADBAADh ds:0023:00000000=???
?????
0:000&amp;gt;
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;If you don't see an access violation occur in the debugger, then you don't have a reliable repro. Go back to creating a small simple repro. (very rarely certain AVs only happen when NOT under a debugger). &lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Setup &lt;A href="http://search.live.com/results.aspx?q=symbol+server+site%3Asupport.microsoft.com" mce_href="http://search.live.com/results.aspx?q=symbol+server+site%3Asupport.microsoft.com"&gt;symbols&lt;/A&gt;: 
&lt;BLOCKQUOTE style="BORDER-RIGHT: #000 1px dotted; PADDING-RIGHT: 1ex; BORDER-TOP: #000 1px dotted; PADDING-LEFT: 1ex; PADDING-BOTTOM: 1ex; BORDER-LEFT: #000 1px dotted; PADDING-TOP: 1ex; BORDER-BOTTOM: #000 1px dotted; FONT-STYLE: normal"&gt;&lt;PRE&gt;0:000&amp;gt; .sympath SRV*c:\localsymbols*http://msdl.microsoft.com/download/symbols
Symbol search path is: SRV*c:\localsymbols*http://msdl.microsoft.com/download/sy
mbols
0:000&amp;gt; .lines
Line number information will be loaded
0:000&amp;gt; k
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdl
l.dll -
ChildEBP RetAddr
WARNING: Stack unwind information not available. Following frames may be wrong.
0014fe28 00371312 av+0x1190
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for D:\W
indows\system32\kernel32.dll -
0014fe6c 76ac1d02 av+0x1312
0014fe78 773b85db kernel32!BaseThreadInitThunk+0x12
0014feb8 773b85ae ntdll!RtlInitializeExceptionChain+0x64
0014fed0 00000000 ntdll!RtlInitializeExceptionChain+0x37
0:000&amp;gt; lml
start    end        module name
00370000 00374000   av         (no symbols)
7c800000 7c8f5000   kernel32   (&lt;FONT style="COLOR: red"&gt;pdb symbols&lt;/FONT&gt;)          c:\symbols\kernel32.pdb\CE
65FAF896A046629C9EC86F626344302\kernel32.pdb
7c900000 7c9b0000   ntdll      (pdb symbols)          c:\symbols\ntdll.pdb\36515
FB5D04345E491F672FA2E2878C02\ntdll.pdb
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;If symbols are working, then, after "k" (stack back trace), "lml" (list loaded modules) will not show "no symbols" or "export symbols". The Microsoft symbol server only gets Microsoft symbols. You'll also need symbols for the application, e.g. If you're debugging PHP use the &lt;A href="http://snap.php.net/" mce_href="http://snap.php.net"&gt;PHP Snapshot&lt;/A&gt; php bits, and then use the "Debug pack" symbols (.sympath+ \path\to\debugpack; .reload). If you're using Ruby, you'll probably need to build from source and then ".sympath+ " to wherever ruby puts the .pdb files. &lt;/LI&gt;
&lt;LI&gt;Share out the stack backtrace (the "k" command's output) with whoever you think may own it. &lt;/LI&gt;&lt;/OL&gt;Other useful tricks: 
&lt;UL&gt;
&lt;LI&gt;Take a memory dump. (".dump /ma \av.dmp") and then share out the av.dmp file and any symbols you did not get from the Microsoft symbol server. &lt;/LI&gt;
&lt;LI&gt;The Windows heap has a built-in memory-checking feature called &lt;A href="http://search.live.com/results.aspx?q=pageheap" mce_href="http://search.live.com/results.aspx?q=pageheap"&gt;pageheap&lt;/A&gt;. It makes debugging certain memory-usage errors extremely easy. On the downside, it slows the process down substantially and uses massive amounts of memory, so use caution before enabling it and remember to turn it off before perf testing. Here is a sample usage: 
&lt;OL&gt;
&lt;LI&gt;ensure no ruby.exe processes exist&lt;/LI&gt;
&lt;LI&gt;gflags /p /enable ruby.exe /full&lt;/LI&gt;
&lt;LI&gt;start ruby.exe, cause av, debug&lt;/LI&gt;
&lt;LI&gt;gflags /p /disable ruby.exe&lt;/LI&gt;
&lt;LI&gt;gflags /p (should say "no application has page heap enabled")&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/UL&gt;Happy Debugging! &lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=1958622" width="1" height="1"&gt;</description></item><item><title>FastCGI Rapid Failure Protection</title><link>http://blogs.iis.net/rickjames/archive/2007/10/12/fastcgi-rapid-failure-protection.aspx</link><pubDate>Fri, 12 Oct 2007 17:56:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1954195</guid><dc:creator>rickjames</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/rickjames/rsscomments.aspx?PostID=1954195</wfw:commentRss><comments>http://blogs.iis.net/rickjames/archive/2007/10/12/fastcgi-rapid-failure-protection.aspx#comments</comments><description>&lt;H1&gt;FastCGI Rapid Failure Protection&lt;/H1&gt;
&lt;P&gt;There are a lot of similarities between FastCGI's Rapid Failure Protection feature and w3svc/WAS', read &lt;A href="http://search.live.com/results.aspx?q=rapid+failure+protection" mce_href="http://search.live.com/results.aspx?q=rapid+failure+protection"&gt;here&lt;/A&gt; for more information.&lt;/P&gt;
&lt;P&gt;FastCGIs performance (vs CGI) is derived from amortizing process creation and startup costs across multiple requests. When a process exits unexpectedly during a FastCGI request, FastCGI needs to spawn another one (expensive). When a process AVs (&lt;A href="http://search.live.com/results.aspx?q=access+violation" mce_href="http://search.live.com/results.aspx?q=access+violation"&gt;Access Violation&lt;/A&gt;), &lt;A href="http://search.live.com/results.aspx?q=windows+error+reporting" mce_href="http://search.live.com/results.aspx?q=windows+error+reporting"&gt;Windows Error Reporting&lt;/A&gt; generates a summary log of the issue (expensive).&lt;/P&gt;
&lt;P&gt;It is not uncommon for a request that fails once to fail every time. If every time a request is made the expensive process creation, process startup and Windows Error Reporting must run, then the failing request is consuming relatively massive amounts of machine resources. (vs a successful request). Meaning most of the machine's resources are going towards doing something that will have no value.&lt;/P&gt;
&lt;P&gt;FastCGI remembers whenever a process exits unexpectedly or misbehaves. If too many of these events occur in too short a period Rapid Failure Protection is enabled. When enabled, all requests to the fastCgi/application will result in HTTP 500s, with the error message: "The FastCGI process has failed frequently recently. Try the request again in a while". After a short period (less than 1 minute), Rapid Failure Protection will be disabled and process creation will start again. If failures start to happen again, then Rapid Failure Protection kicks in again.&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=1954195" width="1" height="1"&gt;</description></item><item><title>IIS 7 C++ Module API Sample: Changing Handlers</title><link>http://blogs.iis.net/rickjames/archive/2007/10/12/iis-7-c-module-api-sample-changing-handlers.aspx</link><pubDate>Fri, 12 Oct 2007 16:14:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1954047</guid><dc:creator>rickjames</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/rickjames/rsscomments.aspx?PostID=1954047</wfw:commentRss><comments>http://blogs.iis.net/rickjames/archive/2007/10/12/iis-7-c-module-api-sample-changing-handlers.aspx#comments</comments><description>&lt;H1&gt;IIS 7 C++ Module API Sample: Changing Handlers&lt;/H1&gt;
&lt;H3&gt;Introduction&lt;/H3&gt;Today's modules looks at how you can programmatically change handlers. RQ_EXECUTE_REQUEST_HANDLER is by far the most common notification used in the IIS 7 pipline. This makes sense because it is where the response is generated. We know how many different response generation techonologies there are out there. The RQ_EXECUTE_REQUEST_HANDLER notification is only delivered to the modules configured in system.webServer/handlers for the request. This is unlike all other request (RQ_*) notifications, where all modules in system.webServer/modules, that have registered for a notification receive it. The system.webServer/handlers configuration syntax is pretty flexible, but obviously cannot do everything for everyone. This post assumes you've already got the &lt;A href="http://blogs.iis.net/rickjames/archive/2007/02/26/iis-7-hello-world-module-walkthrough.aspx" mce_href="http://blogs.iis.net/rickjames/archive/2007/02/26/iis-7-hello-world-module-walkthrough.aspx"&gt;hello world&lt;/A&gt; module working, so it jumps straight into API discussion. 
&lt;H3&gt;Pipeline&lt;/H3&gt;Here is the first portion of request pipeline. (from the top of httpserv.h) You can see there's an entire notification dedicated to handler selection. You can also see that by this point in the pipeline the request is already authenticated and authorized. 
&lt;BLOCKQUOTE style="BORDER-RIGHT: #000 1px dotted; PADDING-RIGHT: 1ex; BORDER-TOP: #000 1px dotted; PADDING-LEFT: 1ex; PADDING-BOTTOM: 1ex; BORDER-LEFT: #000 1px dotted; PADDING-TOP: 1ex; BORDER-BOTTOM: #000 1px dotted; FONT-STYLE: normal"&gt;&lt;PRE&gt;#define RQ_BEGIN_REQUEST               0x00000001
#define RQ_AUTHENTICATE_REQUEST        0x00000002
#define RQ_AUTHORIZE_REQUEST           0x00000004
#define RQ_RESOLVE_REQUEST_CACHE       0x00000008
&lt;FONT style="COLOR: red"&gt;#define RQ_MAP_REQUEST_HANDLER         0x00000010&lt;/FONT&gt;
#define RQ_ACQUIRE_REQUEST_STATE       0x00000020
#define RQ_PRE_EXECUTE_REQUEST_HANDLER 0x00000040 
&lt;FONT style="COLOR: red"&gt;#define RQ_EXECUTE_REQUEST_HANDLER     0x00000080&lt;/FONT&gt;
...
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;H3&gt;Deciding When to Change Handlers&lt;/H3&gt;The whole reason we're writing this module is because the built-in system.webServer/handlers configuration does not meet our needs. So we need our own logic. In this case we're going to target some special logic that Ruby on Rails seems to like: deliver that which can be delivered and render the rest unto Rails. First we check if we have a IScriptMapInfo already associated with the request. If we do it means that system.webServer/handlers could find a handler. If no handler could be found it means we should deliver it to Rails. If we can find a handler then we need some additional checks: first we use IHttpContext::GetFileInfo to check if this request maps to a file on the file system. Finally, some handlers do not need file system backing, so we compare IScriptMapInfo::GetResourceType to 3. (3 is from the system.webServer/handlers definition in %WinDir%\system32\inetsrv\config\schema\iis_schema.xml) 
&lt;BLOCKQUOTE style="BORDER-RIGHT: #000 1px dotted; PADDING-RIGHT: 1ex; BORDER-TOP: #000 1px dotted; PADDING-LEFT: 1ex; PADDING-BOTTOM: 1ex; BORDER-LEFT: #000 1px dotted; PADDING-TOP: 1ex; BORDER-BOTTOM: #000 1px dotted; FONT-STYLE: normal"&gt;&lt;PRE&gt;MODULE::OnMapRequestHandler(
    IHttpContext*           pContext,
    IMapHandlerProvider*    pProvider
)
{
    ...

    IScriptMapInfo* pScriptMap = pContext-&amp;gt;GetScriptMap( );

    ...

    if( NULL != pScriptMap )
    {
        if(
            NULL != pContext-&amp;gt;GetFileInfo( ) ||
            3 == pScriptMap-&amp;gt;GetResourceType( )
        )
        {
            //
            // if we have a script map AND
            //      - a file info
            //      - or resourceType=Unspecified (3)
            // then no need to change handlers
            //
            goto Finished;
        }
    }
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;H3&gt;Choosing the New Handler&lt;/H3&gt;We now know that we want to deliver the request to Rails. One solution at this point would be to implement IScriptMapInfo and set the IScriptMapInfo::GetModules to be our Rails handler module. The problem with this solution is that there is more than one way to run Rails on IIS, so we don't know which module should handle Rails. So we need to expose some configuration to the web server administrator. At this point we could get into &lt;A href="http://search.live.com/results.aspx?q=iis+schema+extensibility" mce_href="http://search.live.com/results.aspx?q=iis+schema+extensibility"&gt;schema extensibility&lt;/A&gt;, but there's already a perfectly good configuration section that does almost exactly what we want: system.webServer/handlers! :-). So we tweak the URL to make it look like something system.webServer/handlers would understand (replace the stuff after the last slash with index.rb) and then we ask IIS to do the work for us: 
&lt;BLOCKQUOTE style="BORDER-RIGHT: #000 1px dotted; PADDING-RIGHT: 1ex; BORDER-TOP: #000 1px dotted; PADDING-LEFT: 1ex; PADDING-BOTTOM: 1ex; BORDER-LEFT: #000 1px dotted; PADDING-TOP: 1ex; BORDER-BOTTOM: #000 1px dotted; FONT-STYLE: normal"&gt;&lt;PRE&gt;    //
    // Get handler for pszScriptName/APPEND_PATH
    //
    hr = pContext-&amp;gt;MapHandler(
        pSite-&amp;gt;GetSiteId( ),
        pSite-&amp;gt;GetSiteName( ),
        pszFullAppPath,
        pRequest-&amp;gt;GetHttpMethod( ),
        &amp;amp;pScriptMap,
        FALSE
    );
    if( FAILED( hr ) )
    {
        goto Finished;
    }

    //
    // Now make that the handler for this request
    //
    pProvider-&amp;gt;SetScriptMap( pScriptMap );
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;H3&gt;Deployment&lt;/H3&gt;Since this is a C++ module it needs to be in system.webServer/globalModules. Since this module uses RQ_* notifications is need to be in the application module list (system.webServer/modules). This later requirement means you now have a method for turning this custom handler selection on/off, cause system.webServer/modules is configurable at the application level. (e.g. only add the module in web.configs where you want Rails-style handler mapping). Finally, cause we're using the system.webServer/handlers configuration, we should add an entry for *.rb, mine looks like: 
&lt;BLOCKQUOTE style="BORDER-RIGHT: #000 1px dotted; PADDING-RIGHT: 1ex; BORDER-TOP: #000 1px dotted; PADDING-LEFT: 1ex; PADDING-BOTTOM: 1ex; BORDER-LEFT: #000 1px dotted; PADDING-TOP: 1ex; BORDER-BOTTOM: #000 1px dotted; FONT-STYLE: normal"&gt;&lt;PRE&gt;    &amp;lt;location path="" overrideMode="Allow"&amp;gt;
        &amp;lt;system.webServer&amp;gt;
            &amp;lt;handlers accessPolicy="Read, Script"&amp;gt;
                ...
                &amp;lt;add 
                    name="rails (currently broken)" 
                    path="*.rb" 
                    verb="GET,HEAD,POST" 
                    modules="FastCgiModule" 
                    scriptProcessor="c:\ruby\ruby.exe" 
                    resourceType="Unspecified" 
                /&amp;gt;
                ...
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;H3&gt;Expected Behaviour&lt;/H3&gt;
&lt;UL&gt;
&lt;LI&gt;http://localhost/a.rb should get an HTTP 500 with detailed error of "&amp;lt;handler&amp;gt; scriptProcessor could not be found in &amp;lt;fastCGI&amp;gt; application configuration." (I still haven't got Rails working as a FastCGI on IIS 7, I'll blog about it when I do) &lt;/LI&gt;
&lt;LI&gt;http://localhost/app1/recipe/new should get the same HTTP 500 if our module is running and a regular HTTP 404 if not &lt;/LI&gt;
&lt;LI&gt;"Failed Request Tracing" log should have something like this: 
&lt;BLOCKQUOTE style="BORDER-RIGHT: #000 1px dotted; PADDING-RIGHT: 1ex; BORDER-TOP: #000 1px dotted; PADDING-LEFT: 1ex; PADDING-BOTTOM: 1ex; BORDER-LEFT: #000 1px dotted; PADDING-TOP: 1ex; BORDER-BOTTOM: #000 1px dotted; FONT-STYLE: normal"&gt;&lt;PRE&gt;NOTIFY_MODULE_START 
    ModuleName="RubynatorModule"
    Notification="MAP_REQUEST_HANDLER"
HANDLER_CHANGED 
    OldHandlerName="StaticFile"
    NewHandlerName="rails (currently broken)"
    NewHandlerModules="FastCgiModule"
    NewHandlerScriptProcessor="c:\ruby\ruby.exe"
    NewHandlerType=""
NOTIFY_MODULE_END 
    ModuleName="RubynatorModule"
    Notification="MAP_REQUEST_HANDLER"
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;H3&gt;Getting Ruby on Rails Working&lt;/H3&gt;This is beyond the scope of this article, checkout &lt;A href="http://wiki.rubyonrails.org/rails/pages/HowToConfigureIIS7" mce_href="http://wiki.rubyonrails.org/rails/pages/HowToConfigureIIS7"&gt;this&lt;/A&gt; excellent wiki entry. &lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=1954047" width="1" height="1"&gt;</description><enclosure url="http://blogs.iis.net/rickjames/attachment/1954047.ashx" length="91445" type="application/x-zip-compressed" /></item><item><title>IIS 7 C++ Module API Sample: Consuming Trace Events</title><link>http://blogs.iis.net/rickjames/archive/2007/10/10/iis-7-c-module-api-sample-consuming-trace-events.aspx</link><pubDate>Wed, 10 Oct 2007 20:52:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1950556</guid><dc:creator>rickjames</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/rickjames/rsscomments.aspx?PostID=1950556</wfw:commentRss><comments>http://blogs.iis.net/rickjames/archive/2007/10/10/iis-7-c-module-api-sample-consuming-trace-events.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;Introduction&lt;/H3&gt;The attached sample IIS 7 module converts all tracing events into &lt;A href="http://search.live.com/results.aspx?q=outputdebugstring" mce_href="http://search.live.com/results.aspx?q=outputdebugstring"&gt;OutputDebugString&lt;/A&gt; calls. This is not something you'd want to do on a production box, because OutputDebugString can slow machines substantially. It is however very useful when you're performing functional debugging. This post assumes you've already got the &lt;A href="http://blogs.iis.net/rickjames/archive/2007/02/26/iis-7-hello-world-module-walkthrough.aspx" mce_href="http://blogs.iis.net/rickjames/archive/2007/02/26/iis-7-hello-world-module-walkthrough.aspx"&gt;hello world&lt;/A&gt; module working, so it jumps straight into API discussion. (There are many types of tracing from Microsoft, &lt;A href="http://blogs.msdn.com/rickjames/archive/2006/04/27/vista-web-tracing-diagram.aspx" mce_href="http://blogs.msdn.com/rickjames/archive/2006/04/27/vista-web-tracing-diagram.aspx"&gt;here&lt;/A&gt; is a diagram which attempts to show the relationships) 
&lt;H3&gt;Registration&lt;/H3&gt;The module registers to receive trace events. There are many trace events available, so which events you'd like to receive is configured is HTTP_TRACE_CONFIGURATION. The hierarchy is identical to &lt;A href="http://search.live.com/results.aspx?q=event+tracing+for+windows" mce_href="http://search.live.com/results.aspx?q=event+tracing+for+windows"&gt;ETW&lt;/A&gt;'s (provider, area, verbosity). When you configure these settings in the UI for "Failed Request Tracing", iisfreb.dll is converting that configuration into a couple of HTTP_TRACE_CONFIGURATION structures. Providers are identified by a GUID. For simplicity/convenience a special GUID, called &lt;A href="http://search.live.com/results.aspx?q=GUID_IIS_ALL_TRACE_PROVIDERS" mce_href="http://search.live.com/results.aspx?q=GUID_IIS_ALL_TRACE_PROVIDERS"&gt;GUID_IIS_ALL_TRACE_PROVIDERS&lt;/A&gt; is available. It is the equivalent to asking for all registerer trace providers. (Creating a custom provider is not covered in this post) For consistency's sake, the module also has to register for the GL_TRACE_EVENT notification. 
&lt;BLOCKQUOTE style="BORDER-RIGHT: #000 1px dotted; PADDING-RIGHT: 1ex; BORDER-TOP: #000 1px dotted; PADDING-LEFT: 1ex; PADDING-BOTTOM: 1ex; BORDER-LEFT: #000 1px dotted; PADDING-TOP: 1ex; BORDER-BOTTOM: #000 1px dotted; FONT-STYLE: normal"&gt;&lt;PRE&gt;    HTTP_TRACE_CONFIGURATION TraceConfiguration = {0}; 
    TraceConfiguration.pProviderGuid    = &amp;amp;GUID_IIS_ALL_TRACE_PROVIDERS;
    TraceConfiguration.dwAreas          = 0xFFFF;
    TraceConfiguration.dwVerbosity      = 5;
    TraceConfiguration.fProviderEnabled = TRUE;

    ...

    hr = pModuleInfo-&amp;gt;SetGlobalNotifications( pGlobalModule, GL_TRACE_EVENT );

    ...

    hr = pGlobalInfo-&amp;gt;GetTraceContext( )-&amp;gt;
        SetTraceConfiguration( g_pModuleContext, &amp;amp;TraceConfiguration, 1 );
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;H3&gt;Consumption&lt;/H3&gt;Since the module registered for GL_TRACE_EVENT, it must implement &lt;A href="http://search.live.com/results.aspx?q=onglobaltraceevent" mce_href="http://search.live.com/results.aspx?q=onglobaltraceevent"&gt;GLOBAL_MODULE::OnGlobalTraceEvent&lt;/A&gt;. This function is called every time an event is raised. Now it's simply a matter of extracting interesting information from the event and OutputDebugString'ing it: 
&lt;BLOCKQUOTE style="BORDER-RIGHT: #000 1px dotted; PADDING-RIGHT: 1ex; BORDER-TOP: #000 1px dotted; PADDING-LEFT: 1ex; PADDING-BOTTOM: 1ex; BORDER-LEFT: #000 1px dotted; PADDING-TOP: 1ex; BORDER-BOTTOM: #000 1px dotted; FONT-STYLE: normal"&gt;&lt;PRE&gt;    hr = pProvider-&amp;gt;GetTraceEvent( &amp;amp;pEvent );

    ...

    cItems = pEvent-&amp;gt;cEventItems;

    hr = StringCchPrintf(
        pszBuffer,
        sizeof( pszBuffer ) / sizeof( pszBuffer[0] ),
        L"Event: %s (%s,%s,%s,%s)\n",
        pEvent-&amp;gt;pszEventName,
        ...

    OutputDebugString( pszBuffer );
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;Since this module only subscribes to global events, it only needs to be in the &amp;lt;globalModules&amp;gt; list. Once working you should see output like this in your debugger/&lt;A href="http://search.live.com/results.aspx?q=windows+platform+sdk+dbmon" mce_href="http://search.live.com/results.aspx?q=windows+platform+sdk+dbmon"&gt;dbmon&lt;/A&gt;: 
&lt;BLOCKQUOTE style="BORDER-RIGHT: #000 1px dotted; PADDING-RIGHT: 1ex; BORDER-TOP: #000 1px dotted; PADDING-LEFT: 1ex; PADDING-BOTTOM: 1ex; BORDER-LEFT: #000 1px dotted; PADDING-TOP: 1ex; BORDER-BOTTOM: #000 1px dotted; FONT-STYLE: normal"&gt;&lt;PRE&gt;Event: GENERAL_REQUEST_START (,,DefaultAppPool,)
Event: PRE_BEGIN_REQUEST_START (,FailedRequestsTracingModule,,)
Event: PRE_BEGIN_REQUEST_END (,FailedRequestsTracingModule,,)
Event: PRE_BEGIN_REQUEST_START (,RequestMonitorModule,,)
Event: PRE_BEGIN_REQUEST_END (,RequestMonitorModule,,)
Event: PRE_BEGIN_REQUEST_START (,IsapiFilterModule,,)
Event: FILTER_START (,D:\Windows\Microsoft.NET\Framework\v2.0.
50727\aspnet_filter.dll,,)
Event: FILTER_PREPROC_HEADERS_START (,,,)
Event: GENERAL_SET_REQUEST_HEADER (,,,)
Event: FILTER_SET_REQ_HEADER (,,,)
Event: FILTER_PREPROC_HEADERS_END (,,,)
Event: FILTER_END (,,,)
Event: PRE_BEGIN_REQUEST_END (,IsapiFilterModule,,)
Event: GENERAL_REQUEST_HEADERS (,,,)
Event: URL_CACHE_ACCESS_START (,/d,,)
Event: URL_CACHE_ACCESS_END (,,,)
Event: HANDLER_PRECONDITION_NOT_MATCH (,AXD-ISAPI-2.0,class
icMode,runtimeVersion
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=1950556" width="1" height="1"&gt;</description><enclosure url="http://blogs.iis.net/rickjames/attachment/1950556.ashx" length="2633" type="application/x-zip-compressed" /></item><item><title>Installing PHP 5.2.4 on Windows Server 2008 RC0 in Pictures</title><link>http://blogs.iis.net/rickjames/archive/2007/10/04/installing-php-5-2-4-on-windows-server-2008-rc0-in-pictures.aspx</link><pubDate>Fri, 05 Oct 2007 01:40:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1941942</guid><dc:creator>rickjames</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/rickjames/rsscomments.aspx?PostID=1941942</wfw:commentRss><comments>http://blogs.iis.net/rickjames/archive/2007/10/04/installing-php-5-2-4-on-windows-server-2008-rc0-in-pictures.aspx#comments</comments><description>&lt;P&gt;Windows Server 2008 RC0 is now available for &lt;A href="http://www.microsoft.com/windowsserver2008/audsel.mspx" mce_href="http://www.microsoft.com/windowsserver2008/audsel.mspx"&gt;beta testing&lt;/A&gt;. Here are some screenshots of setting up PHP 5.2.4:&lt;/P&gt;&lt;I&gt;Update: 11-Oct: changed image layout, tweaked text&lt;/I&gt; 
&lt;OL&gt;
&lt;LI&gt;
&lt;P&gt;Open Server Manager, Install IIS, including CGI (which include FastCGI)&lt;/P&gt;&lt;IMG src="http://wallpaper.iis7.org/rickj/1-1servermanager-selectrole.jpg" mce_src="http://wallpaper.iis7.org/rickj/1-1servermanager-selectrole.jpg"&gt; &lt;BR&gt;&lt;IMG src="http://wallpaper.iis7.org/rickj/1-2servermanager-selectservice.jpg" mce_src="http://wallpaper.iis7.org/rickj/1-2servermanager-selectservice.jpg"&gt; &lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Download and extract PHP to c:\php, Start the UI (WindowsKey+R - inetmgr)&lt;/P&gt;&lt;IMG src="http://wallpaper.iis7.org/rickj/2-1phpnetdownloads.jpg" mce_src="http://wallpaper.iis7.org/rickj/2-1phpnetdownloads.jpg"&gt; &lt;BR&gt;&lt;IMG src="http://wallpaper.iis7.org/rickj/2-2startruninetmgr.jpg" mce_src="http://wallpaper.iis7.org/rickj/2-2startruninetmgr.jpg"&gt; &lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Create a simple php script c:\inetpub\wwwroot\hello.php:&lt;/P&gt;&lt;IMG src="http://wallpaper.iis7.org/rickj/3-1-inetmgr-explorer.png" mce_src="http://wallpaper.iis7.org/rickj/3-1-inetmgr-explorer.png"&gt; 
&lt;BLOCKQUOTE style="BORDER-RIGHT: #000 1px dotted; PADDING-RIGHT: 1ex; BORDER-TOP: #000 1px dotted; PADDING-LEFT: 1ex; PADDING-BOTTOM: 1ex; BORDER-LEFT: #000 1px dotted; PADDING-TOP: 1ex; BORDER-BOTTOM: #000 1px dotted; FONT-STYLE: normal"&gt;&lt;PRE&gt;&amp;lt;?php phpinfo(); ?&amp;gt;
                    &lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Let IIS know the you want *.php to run as a FastCGI using c:\php\php-cgi.exe&lt;/P&gt;&lt;IMG src="http://wallpaper.iis7.org/rickj/3-2-inetmgr-handlermappings.png" mce_src="http://wallpaper.iis7.org/rickj/3-2-inetmgr-handlermappings.png"&gt; &lt;BR&gt;&lt;IMG src="http://wallpaper.iis7.org/rickj/3-3-inetmgraddmodulemapping.jpg" mce_src="http://wallpaper.iis7.org/rickj/3-3-inetmgraddmodulemapping.jpg"&gt; &lt;BR&gt;&lt;IMG src="http://wallpaper.iis7.org/rickj/3-4-inetmgr-addfastcgiapp.png" mce_src="http://wallpaper.iis7.org/rickj/3-4-inetmgr-addfastcgiapp.png"&gt; &lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;Browse away!&lt;/P&gt;&lt;IMG src="http://wallpaper.iis7.org/rickj/3-5-inetmgr-browsehellophp.png" mce_src="http://wallpaper.iis7.org/rickj/3-5-inetmgr-browsehellophp.png"&gt; &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Server 2008 Beta 3 &lt;A href="http://blogs.iis.net/bills/archive/2007/05/19/how-to-install-fastcgi-and-php-on-iis7-beta-3-video.aspx" mce_href="http://blogs.iis.net/bills/archive/2007/05/19/how-to-install-fastcgi-and-php-on-iis7-beta-3-video.aspx"&gt;experience&lt;/A&gt; (a video)&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=1941942" width="1" height="1"&gt;</description></item><item><title>IIS 7 Talks: Slides</title><link>http://blogs.iis.net/rickjames/archive/2007/05/29/iis-7-talks-slides.aspx</link><pubDate>Tue, 29 May 2007 13:00:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1730426</guid><dc:creator>rickjames</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/rickjames/rsscomments.aspx?PostID=1730426</wfw:commentRss><comments>http://blogs.iis.net/rickjames/archive/2007/05/29/iis-7-talks-slides.aspx#comments</comments><description>&lt;P mce_keep="true"&gt;Will and I had the pleasure of presenting IIS 7 to audiences in 6 &lt;A class="" href="http://blogs.iis.net/rickjames/archive/2007/05/10/iis-7-talks-zagreb-athens-brussels-and-belgrade.aspx" mce_href="http://blogs.iis.net/rickjames/archive/2007/05/10/iis-7-talks-zagreb-athens-brussels-and-belgrade.aspx"&gt;countries&lt;/A&gt;&amp;nbsp;in the last 2 weeks. Sorry to people who found out about the presentations too late to attend. I've attached a copy of the slides we used. You may also want to see the shared hosting on IIS 7 &lt;A class="" href="http://weblogs.asp.net/hosterposter/archive/2007/05/28/iis7-shared-hosting-guidance.aspx" mce_href="http://weblogs.asp.net/hosterposter/archive/2007/05/28/iis7-shared-hosting-guidance.aspx"&gt;document&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=1730426" width="1" height="1"&gt;</description><enclosure url="http://blogs.iis.net/rickjames/attachment/1730426.ashx" length="2316162" type="application/x-zip-compressed" /></item><item><title>IIS 7 Talks: Zagreb, Athens, Brussels and Belgrade</title><link>http://blogs.iis.net/rickjames/archive/2007/05/10/iis-7-talks-zagreb-athens-brussels-and-belgrade.aspx</link><pubDate>Thu, 10 May 2007 12:53:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1704150</guid><dc:creator>rickjames</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/rickjames/rsscomments.aspx?PostID=1704150</wfw:commentRss><comments>http://blogs.iis.net/rickjames/archive/2007/05/10/iis-7-talks-zagreb-athens-brussels-and-belgrade.aspx#comments</comments><description>&lt;p&gt;As previously mentioned, in the next two weeks, Will and I will be doing a bunch of IIS 7 day-long talks. (Brett and Isaac will visit other countries, see &lt;a href="http://brettblog.com/PermaLink,guid,ed24c5d3-14f0-44a8-8a32-f60073600ce8.aspx" class=""&gt;here&lt;/a&gt; for the full list) Final locations and dates:&lt;/p&gt;
&lt;p&gt;14 May: &lt;a href="http://www.microsoft.com/iceland/events/webadmin_iceland.mspx%20" class=""&gt;Reykjavik&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;16 May: &lt;a href="http://croatia.tsrportal.com/" class=""&gt;Zagreb&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;18 May: &lt;a href="http://www.microsoft.com/hellas/events/web_administration_summit.mspx%20" class=""&gt;Athens&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;21 May: &lt;a href="http://wwwppe/belux/technet/nl/events/2007/webadmintour.mspx" class=""&gt;Belgium&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;23 May: &lt;a href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032339368&amp;amp;Culture=en-GB%20%20" class=""&gt;London&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;25 May: Belgrade (message me for registration information, I don't have a link)&lt;/p&gt;
&lt;p&gt;Looking forward to seeing you there!&lt;/p&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=1704150" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/rickjames/archive/tags/IIS+News+Item/default.aspx">IIS News Item</category><category domain="http://blogs.iis.net/rickjames/archive/tags/Roadshow/default.aspx">Roadshow</category></item><item><title>IIS 7 Talks: Reykjavik and London</title><link>http://blogs.iis.net/rickjames/archive/2007/05/06/iis-7-talks-reykjavik-and-london.aspx</link><pubDate>Sun, 06 May 2007 11:53:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1697029</guid><dc:creator>rickjames</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/rickjames/rsscomments.aspx?PostID=1697029</wfw:commentRss><comments>http://blogs.iis.net/rickjames/archive/2007/05/06/iis-7-talks-reykjavik-and-london.aspx#comments</comments><description>&lt;P&gt;Will and I will be presenting one day talks, aimed at IT&amp;nbsp;professionals,&amp;nbsp;about IIS 7. Schedule:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;14 May: Reykjavik&amp;nbsp;(&lt;A class="" href="http://www.microsoft.com/iceland/events/webadmin_iceland.mspx"&gt;details and registration&lt;/A&gt;)&lt;/LI&gt;
&lt;LI&gt;23 May: London&amp;nbsp;(&lt;A class="" href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032339368&amp;amp;Culture=en-GB"&gt;details and registration&lt;/A&gt;)&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;We're still finalizing details, but it looks like we'll also be talking in Zagreb, Athens, Brussels and Belgrade.&amp;nbsp;Topics:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Overview&lt;/LI&gt;
&lt;LI&gt;New UI&lt;/LI&gt;
&lt;LI&gt;Shared Configuration, Remote Administration and Tools&lt;/LI&gt;
&lt;LI&gt;Security&lt;/LI&gt;
&lt;LI&gt;Troubleshooting&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Looking forward to seeing iis.net people there!&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=1697029" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/rickjames/archive/tags/IIS+News/default.aspx">IIS News</category><category domain="http://blogs.iis.net/rickjames/archive/tags/IIS+News+Item/default.aspx">IIS News Item</category></item><item><title>FastCGI TP2 - Unofficial Update 70419</title><link>http://blogs.iis.net/rickjames/archive/2007/04/19/fastcgi-tp2-unofficial-update-70419.aspx</link><pubDate>Thu, 19 Apr 2007 16:56:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1673360</guid><dc:creator>rickjames</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/rickjames/rsscomments.aspx?PostID=1673360</wfw:commentRss><comments>http://blogs.iis.net/rickjames/archive/2007/04/19/fastcgi-tp2-unofficial-update-70419.aspx#comments</comments><description>&lt;P&gt;FastCGI tech preview 2 went out a long time ago. Since then there has been tons of excellent feedback in the FastCGI forums on &lt;A href="http://forums.iis.net/" mce_href="http://forums.iis.net/"&gt;http://forums.iis.net&lt;/A&gt;. Thank you!&lt;/P&gt;
&lt;P&gt;Unfortunately it's going to be a while before there's another official tech preview / beta. In the mean time, I've attached bits that contain fixes for all issues reported to date. I must warn you: The attached update bits have not been as thoroughly tested as TP2, so you mileage may vary. Please report any issues you encounter to forums.iis.net and highlight that you're using unofficial update 70419.&lt;/P&gt;
&lt;P&gt;In other good FastCGI news: FastCGI will be in Longhorn Server Beta 3! (not released yet)&lt;BR&gt;&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=1673360" width="1" height="1"&gt;</description><enclosure url="http://blogs.iis.net/rickjames/attachment/1673360.ashx" length="307093" type="application/x-zip-compressed" /><category domain="http://blogs.iis.net/rickjames/archive/tags/IIS+News+Item/default.aspx">IIS News Item</category></item><item><title>IIS 7 Hello World Module Walkthrough</title><link>http://blogs.iis.net/rickjames/archive/2007/02/26/iis-7-hello-world-module-walkthrough.aspx</link><pubDate>Tue, 27 Feb 2007 07:53:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1596352</guid><dc:creator>rickjames</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/rickjames/rsscomments.aspx?PostID=1596352</wfw:commentRss><comments>http://blogs.iis.net/rickjames/archive/2007/02/26/iis-7-hello-world-module-walkthrough.aspx#comments</comments><description>&lt;P&gt;The other day I found out that the Vista SDK includes a compiler. I was very excited to find this out, cause now creating a "Hello World" IIS 7 C++ module only requires one huge install (and two little ones).&lt;/P&gt;
&lt;P&gt;Build: 
&lt;OL&gt;
&lt;LI&gt;Install the &lt;A href="http://search.live.com/results.aspx?q=vista+sdk"&gt;Vista SDK&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Unzip attached helloworld.zip to \temp\hello&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;cd "\Program Files\Microsoft SDKs\Windows\v6.0\Bin"&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;setenv.cmd /debug /x86 /vista&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;cd \temp\hello&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;build.bat&lt;/CODE&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Deploy: 
&lt;OL&gt;
&lt;LI&gt;&lt;CODE&gt;cd %windir%\system32\inetsrv&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;appcmd add backup hellobackup&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;appcmd install module /name:Helloworld /image:\temp\hello\hello_world.dll&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;appcmd set config -section:handlers "-+[name='HelloHandler',path='*.hello',verb='*',modules='Helloworld']"&lt;/CODE&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Test: 
&lt;OL&gt;
&lt;LI&gt;Install &lt;A href="http://search.live.com/results.aspx?q=wfetch"&gt;wfetch&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Set the path field to: /a.hello 
&lt;LI&gt;Expected: Hello World &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Debug: 
&lt;OL&gt;
&lt;LI&gt;Install the &lt;A href="http://search.live.com/results.aspx?q=%22Debugging+Tools+for+Windows%22"&gt;debugger&lt;/A&gt; to c:\debuggers (checkout c:\debuggers\debugger.chm index tab for more details on the commands below)&lt;/LI&gt;
&lt;LI&gt;cmd: &lt;CODE&gt;net stop was /y&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;cmd: &lt;CODE&gt;cd %windir%\system32\inetsrv&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;cmd: &lt;CODE&gt;c:\debuggers\windbg -2 -g -G w3wp.exe /debug&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;debugger: Ctrl-Break&lt;/LI&gt;
&lt;LI&gt;debugger: &lt;CODE&gt;.sympath SRV*c:\localsymbols*http://msdl.microsoft.com/download/symbols&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;debugger: &lt;CODE&gt;bm hello_world!*execute*&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;debugger: &lt;CODE&gt;g&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;wfetch: F5&lt;/LI&gt;&lt;/OL&gt;May the force be with you :-).&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=1596352" width="1" height="1"&gt;</description><enclosure url="http://blogs.iis.net/rickjames/attachment/1596352.ashx" length="2330" type="application/x-zip-compressed" /></item><item><title>Fake FastCGI Web Server</title><link>http://blogs.iis.net/rickjames/archive/2007/02/04/fake-fastcgi-web-server.aspx</link><pubDate>Sun, 04 Feb 2007 21:18:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1563148</guid><dc:creator>rickjames</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/rickjames/rsscomments.aspx?PostID=1563148</wfw:commentRss><comments>http://blogs.iis.net/rickjames/archive/2007/02/04/fake-fastcgi-web-server.aspx#comments</comments><description>&lt;P&gt;When developing a new FastCGI library, the web server can get in the way. The attached program wraps a FastCGI executable in a minimal FastCGI environment. It should be enough to get "hello world" working. It only uses named pipes. It doesn't exercise all FastCGI protocol features. Sample PHP 5 run:&lt;/P&gt;
&lt;P&gt;C:\&amp;gt;fakefcgi.exe c:\Inetpub\wwwroot\hello.php c:\php\php-cgi.exe &lt;PRE class="code language-C#"&gt;Fake FastCGI web server
FCGI_PARAMS sent
FCGI_STDIN sent
Launching receive loop
FCGI_STDOUT: &lt;STRONG&gt;X-Powered-By: PHP/5.2.1RC2-dev
Content-type: text/html

Hello World 2 from IIS&lt;/STRONG&gt;

FCGI_END_REQUEST received
killing app
FastCGI process exited with 0
&lt;/PRE&gt;
&lt;P&gt;C:\&amp;gt;type c:\Inetpub\wwwroot\hello.php &amp;lt;?php echo 'Hello World 2 from IIS'; ?&amp;gt; &lt;BR&gt;Sample Perl run:&lt;/P&gt;
&lt;P&gt;C:\&amp;gt;fakefcgi.exe c:\Inetpub\wwwroot\hello.plfcgi "C:\Perl\bin\perl.exe c:\inetpub\wwwroot\hello.plfcgi"&lt;/P&gt;&lt;PRE class="code language-C#"&gt;Fake FastCGI web server
FCGI_PARAMS sent
FCGI_STDIN sent
Launching receive loop
FCGI_STDOUT: &lt;B&gt;hello world&lt;/B&gt;
FCGI_STDOUT: (null)
FCGI_END_REQUEST received
killing app
FastCGI process exited with 0

C:\&amp;gt;type c:\Inetpub\wwwroot\hello.plfcgi
use CGI::Fast qw(:standard);
$COUNTER = 0;
while (new CGI::Fast) {
    print "hello world";
}&lt;/PRE&gt;
&lt;P&gt;As you can see, this is only really useful for the initial development of a Windows FastCGI Named Pipe library. That being said, once in a while it's useful to see a script running from the command line inside FastCGI.&lt;/P&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=1563148" width="1" height="1"&gt;</description><enclosure url="http://blogs.iis.net/rickjames/attachment/1563148.ashx" length="37189" type="application/x-zip-compressed" /></item><item><title>IIS 7 FastCGI Module</title><link>http://blogs.iis.net/rickjames/archive/2006/10/31/IIS-7-FastCGI-Module.aspx</link><pubDate>Tue, 31 Oct 2006 17:47:00 GMT</pubDate><guid isPermaLink="false">50bcf3b4-f6fe-4638-adff-0c150e922e99:1448240</guid><dc:creator>rickjames</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.iis.net/rickjames/rsscomments.aspx?PostID=1448240</wfw:commentRss><comments>http://blogs.iis.net/rickjames/archive/2006/10/31/IIS-7-FastCGI-Module.aspx#comments</comments><description>&lt;P&gt;The IIS FastCGI preview is ready! I spent the last month developing the IIS 7 FastCGI module. Wade has adapted the module to work as an ISAPI on IIS 6 (and unofficially on IIS 5). Marchel and Mukhtar (and recently Cip) have been testing until late in the evenings for the last few weeks. Bill and Mike have been managing the project. It was really exciting going from nothing to something in 1 month. Normally we take product development at a slower pace.&lt;/P&gt;
&lt;P&gt;Thank you to these excellent PHP developers: Dmitry, Wez, Andi and Stanislav. I'm guessing most of them are currently at the &lt;A href="http://www.zend.com/"&gt;San Jose Zend/PHP Conference&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I don't know what throughput numbers will be officially recorded, but unofficial ones I've tested (helloworld.php, Longhorn Server, pre-release PHP bits) are running 25x (twenty-five TIMES) faster than running PHP as a CGI. So this is a real win for people who cannot run PHP as an ISAPI. (Some PHP extensions are not thread safe and therefore couldn't be run safely as ISAPIs. I don't know which ones, just have nasty stories from Andreas in CSS)&lt;/P&gt;
&lt;P&gt;Technology Preview 1 is be available on &lt;A href="http://www.iis.net/"&gt;www.iis.net&lt;/A&gt;. So far I've only tested it with &lt;A href="http://www.php.net/"&gt;PHP&lt;/A&gt; and the &lt;A href="http://www.fastcgi.com/"&gt;libfcgi&lt;/A&gt; SDK sample echo.exe. I'd love us to try out some other technologies, so if you have any suggestions please comment on the FastCGI forums. If you find any FastCGI apps we're incompatible with, please bring it to our attention and we'll get them working!&lt;/P&gt;Overview of the current design (which could change substantially before release): 
&lt;UL&gt;
&lt;LI&gt;Configuration applies at the worker process level &lt;/LI&gt;
&lt;LI&gt;Each worker process can be configured to run many FastCGI process pools &lt;/LI&gt;
&lt;LI&gt;Each process pool can be configured independently &lt;/LI&gt;
&lt;LI&gt;Processes are spawned on demand up to the maximum (there is no MinServers setting) &lt;/LI&gt;
&lt;LI&gt;If there are more requests than processes, requests are queued up to request limits &lt;/LI&gt;
&lt;LI&gt;If a FastCGI process has been idle for more than 5 minutes we retire it &lt;/LI&gt;&lt;/UL&gt;IIS 7 configuration settings (per process pool): 
&lt;UL&gt;
&lt;LI&gt;fullPath: path to application for this pool (e.g. d:\php\php-cgi.exe, NOTE: must match handlers section) &lt;/LI&gt;
&lt;LI&gt;maxInstances: maximum number of processes to create in this pool &lt;/LI&gt;
&lt;LI&gt;instanceTimeout: maximum duration a request can last &lt;/LI&gt;
&lt;LI&gt;instanceMaxRequests: process will be retired after exceeding this number of requests &lt;/LI&gt;
&lt;LI&gt;protocol: use named pipes or tcp. The tech preview currently only supports named pipes, but TCP should be simple to add. &lt;/LI&gt;
&lt;LI&gt;queueLength: maximum number of requests to queue (when this is exceeded the module will start 500'ing) &lt;/LI&gt;
&lt;LI&gt;flushNamedPipe: Flush the named pipe at the end of each request. This is to workaround, what seems to be a bug in libfcgi: if two FastCGI requests arrive in a single ReadFile call, libfcgi closes the pipe. (If anyone wants to tackle this problem, I'd be happy to provide a repro) &lt;/LI&gt;&lt;/UL&gt;Links: 
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://www.iis.net/default.aspx?tabid=1000051"&gt;http://www.iis.net/default.aspx?tabid=1000051&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://www.zend.com/products/zend_core/windows_preview"&gt;Zend Windows PHP FastCGI/CGI Optimized Build&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://forums.iis.net/1103/ShowForum.aspx"&gt;http://forums.iis.net/1103/ShowForum.aspx&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://forums.iis.net/1104/ShowForum.aspx"&gt;http://forums.iis.net/1104/ShowForum.aspx&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://forums.iis.net/1102/ShowForum.aspx"&gt;http://forums.iis.net/1102/ShowForum.aspx&lt;/A&gt; &lt;/LI&gt;&lt;/UL&gt;&lt;img src="http://blogs.iis.net/aggbug.aspx?PostID=1448240" width="1" height="1"&gt;</description><category domain="http://blogs.iis.net/rickjames/archive/tags/IIS+News/default.aspx">IIS News</category></item></channel></rss>