<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>iis7 &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/iis7/</link>
	<description>Feed of posts on WordPress.com tagged "iis7"</description>
	<pubDate>Mon, 28 Dec 2009 01:38:06 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Visual Studio - Attach to running local web site process to debug (and cannot see w3wp.exe?)]]></title>
<link>http://simonhibbard.wordpress.com/2009/12/22/visual-studio-attach-to-running-local-web-site-process-to-debug-and-cannot-see-w3wp-exe/</link>
<pubDate>Tue, 22 Dec 2009 11:34:59 +0000</pubDate>
<dc:creator>shibbard</dc:creator>
<guid>http://simonhibbard.wordpress.com/2009/12/22/visual-studio-attach-to-running-local-web-site-process-to-debug-and-cannot-see-w3wp-exe/</guid>
<description><![CDATA[I had this problem where I wanted to attach my Visual Studio debugger to and already running website]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I had this problem where I wanted to attach my Visual Studio debugger to and already running website on local host.</p>
<p>From a bit of Googleing I found the process I needed to attach to was the IIS worker process called w3wp.exe, but this was not in my list. I noticed if I refreshed the site and then looked quickly in the process list it was there but then dissapeared shortly after &#8211; so a timeout I guessed.</p>
<p>This is what was happening, so I needed to stop it from timing out or at least delay it.</p>
<p>The answer was to change a setting in the applicaiton pool &#8211; &#8216;Shutdown Time Limit&#8217;.</p>
<p>Solution Summary:<br />
- Goto IIS and find the website or application you want to modify.<br />
- Click advanced settings to find the applicaiton pool it is using (or as I did create a new application pool and assign this website to use it)<br />
- Goto your application pool list &#8211; selected advanced settings<br />
- Change the &#8216;Shutdown Time Limit&#8217; to something like 1000 (seconds) its default is 90</p>
<p>w3wp.exe should now hang around long enough to attach to it with the debugger <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[if you are expecting too much data from wcf service]]></title>
<link>http://dotnettrails.wordpress.com/2009/11/09/if-you-are-expecting-too-much-data-from-wcf-service/</link>
<pubDate>Mon, 09 Nov 2009 12:25:56 +0000</pubDate>
<dc:creator>dotnettrails</dc:creator>
<guid>http://dotnettrails.wordpress.com/2009/11/09/if-you-are-expecting-too-much-data-from-wcf-service/</guid>
<description><![CDATA[Use WCF basicHTTPBinding as the binding. By default it will be wsHTTPBinding &lt;system.serviceModel]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Use WCF basicHTTPBinding as the binding. By default it will be wsHTTPBinding</p>
<p>&#60;system.serviceModel&#62;   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;behaviors&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;serviceBehaviors&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;behavior name=&#34;ServiceBehavior&#34;&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;serviceMetadata httpGetEnabled=&#34;true&#34;/&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;serviceDebug includeExceptionDetailInFaults=&#34;true&#34;/&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;/behavior&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;/serviceBehaviors&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;/behaviors&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;services&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;service behaviorConfiguration=&#34;ServiceBehavior&#34; name=&#34;Service&#34;&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;endpoint address=&#34;&#34; binding=&#34;<strong>basicHttpBinding</strong>&#34; contract=&#34;IService&#34;&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;/endpoint&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;endpoint address=&#34;mex&#34; binding=&#34;mexHttpBinding&#34; contract=&#34;IMetadataExchange&#34;/&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;/service&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;/services&#62;    <br />&#160;&#160;&#160; &#60;/system.serviceModel&#62;</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:cebb5df5-7af8-43b8-8053-7984df7634c8" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/WCF" rel="tag">WCF</a>,<a href="http://technorati.com/tags/WPF" rel="tag">WPF</a>,<a href="http://technorati.com/tags/ASP.Net" rel="tag">ASP.Net</a>,<a href="http://technorati.com/tags/Windows+forms" rel="tag">Windows forms</a>,<a href="http://technorati.com/tags/Silverlight" rel="tag">Silverlight</a>,<a href="http://technorati.com/tags/Configuration" rel="tag">Configuration</a>,<a href="http://technorati.com/tags/IIS7" rel="tag">IIS7</a>,<a href="http://technorati.com/tags/web.config" rel="tag">web.config</a>,<a href="http://technorati.com/tags/app.config" rel="tag">app.config</a></div>
<p align="left">On your client application [web/wpf/silverlight] set the same with maxReceivedMessageSize, maxBufferPoolSize, maxStringContentLength and maxArrayLength to 2147483647 as shown below</p>
<p>&#60;system.serviceModel&#62;   <br />&#160;&#160;&#160;&#160;&#160;&#160; &#60;bindings&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;basicHttpBinding&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;binding name=&#34;BasicHttpBinding_IService&#34; closeTimeout=&#34;00:01:00&#34;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; openTimeout=&#34;00:01:00&#34; receiveTimeout=&#34;00:10:00&#34; sendTimeout=&#34;00:01:00&#34;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; allowCookies=&#34;false&#34; bypassProxyOnLocal=&#34;false&#34; hostNameComparisonMode=&#34;StrongWildcard&#34;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; maxBufferSize=&#34;2147483647&#34; <strong>maxBufferPoolSize=&#34;2147483647&#34;     <br /></strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <strong>maxReceivedMessageSize=&#34;2147483647&#34;</strong> messageEncoding=&#34;Text&#34;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; textEncoding=&#34;utf-8&#34; transferMode=&#34;Buffered&#34; useDefaultWebProxy=&#34;true&#34;&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;readerQuotas maxDepth=&#34;32&#34; <strong>maxStringContentLength=&#34;2147483647&#34;     <br /></strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <strong>maxArrayLength=&#34;2147483647&#34;</strong> maxBytesPerRead=&#34;4096&#34; maxNameTableCharCount=&#34;16384&#34; /&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;security mode=&#34;None&#34;&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;transport clientCredentialType=&#34;None&#34; proxyCredentialType=&#34;None&#34;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; realm=&#34;&#34; /&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;message clientCredentialType=&#34;UserName&#34; algorithmSuite=&#34;Default&#34; /&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;/security&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;/binding&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;/basicHttpBinding&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160; &#60;/bindings&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160; &#60;client&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;endpoint address=&#34;http://yourwebserver/yourservice.svc<a href="http://ht2.vitalaxis.com/printrequest/Service.svc&#34;">&#34;</a>    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; binding=&#34;basicHttpBinding&#34; bindingConfiguration=&#34;BasicHttpBinding_IService&#34;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; contract=&#34;ServiceReference1.IService&#34; name=&#34;BasicHttpBinding_IService&#34; /&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160; &#60;/client&#62;    <br />&#160;&#160; &#60;/system.serviceModel&#62;</p>
<p>That should do <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[wcf: maximum string length quota (8192) has been exceeded]]></title>
<link>http://dotnettrails.wordpress.com/2009/11/09/wcf-maximum-string-length-quota-8192-has-been-exceeded/</link>
<pubDate>Mon, 09 Nov 2009 05:19:19 +0000</pubDate>
<dc:creator>dotnettrails</dc:creator>
<guid>http://dotnettrails.wordpress.com/2009/11/09/wcf-maximum-string-length-quota-8192-has-been-exceeded/</guid>
<description><![CDATA[Technorati Tags: WCF,IIS7,Error Handling,web.config If you get ‘The maximum string content length qu]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><div style="display:inline;float:none;margin:0;padding:0;" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:6998f87a-b288-4724-b437-9df55dd8a04d" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/WCF" rel="tag">WCF</a>,<a href="http://technorati.com/tags/IIS7" rel="tag">IIS7</a>,<a href="http://technorati.com/tags/Error+Handling" rel="tag">Error Handling</a>,<a href="http://technorati.com/tags/web.config" rel="tag">web.config</a></div>
<p>If you get ‘The maximum string content length quota (8192) has been exceeded while reading XML data’ error from WCF service, it is because the output has restrictions in web.config of client application.</p>
<p>Go ahead and set maxReceivedMessageSize, maxStringContentLength, maxDepth, maxArrayLength sizes to the max possible 2147483647 in client application’s (WPF / Silverlight / ASP.Net ) web.config/app.config.</p>
<p>&#60;system.serviceModel&#62;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;bindings&#62;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;wsHttpBinding&#62;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;binding name=&#34;WSHttpBinding_IAdwService&#34;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; bypassProxyOnLocal=&#34;false&#34;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; transactionFlow=&#34;false&#34;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hostNameComparisonMode=&#34;StrongWildcard&#34;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; maxBufferPoolSize=&#34;524288&#34;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; maxReceivedMessageSize=&#34;2147483647&#34;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; messageEncoding=&#34;Text&#34;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; textEncoding=&#34;utf-8&#34;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; useDefaultWebProxy=&#34;true&#34;&#62;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;readerQuotas maxDepth=&#34;2147483647&#34; maxStringContentLength=&#34;2147483647&#34; maxArrayLength=&#34;2147483647&#34; maxBytesPerRead=&#34;4012&#34; maxNameTableCharCount=&#34;8192&#34;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /&#62;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;reliableSession ordered=&#34;true&#34; inactivityTimeout=&#34;00:10:00&#34; enabled=&#34;false&#34; /&#62;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;security mode=&#34;Message&#34;&#62;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;transport clientCredentialType=&#34;None&#34; proxyCredentialType=&#34;None&#34; realm=&#34;&#34; /&#62;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;message clientCredentialType=&#34;Windows&#34; negotiateServiceCredential=&#34;true&#34; establishSecurityContext=&#34;true&#34; /&#62;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;/security&#62;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;/binding&#62;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;/wsHttpBinding&#62;</p>
<p>Do not unnecessarily increase the value as it might defeat the purpose under DOS attacks. </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Microsoft Remotedebugging: Windows 7 in einer virtuellen Parallels Maschine auf einem Apple MacBook]]></title>
<link>http://blog.pmd-media.com/2009/11/06/microsoft-remotedebugging-windows-7-in-einer-virtuellen-parallels-maschine-auf-einem-apple-macbook/</link>
<pubDate>Fri, 06 Nov 2009 17:43:48 +0000</pubDate>
<dc:creator>Frank Piotrowsky</dc:creator>
<guid>http://blog.pmd-media.com/2009/11/06/microsoft-remotedebugging-windows-7-in-einer-virtuellen-parallels-maschine-auf-einem-apple-macbook/</guid>
<description><![CDATA[Ich habe wirklich hart kämpfen müssen, obwohl die Lösung ganz einfach war&#8230;. Hinterher ist man ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Ich habe wirklich hart kämpfen müssen, obwohl die Lösung ganz einfach war&#8230;. Hinterher ist man immer schlauer <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .</p>
<h3>Konfiguration</h3>
<ul>
<li>Microsoft Windows 7</li>
<li>Microsoft Visual Studio 2010 Beta 2</li>
<li>Parallels 4.0</li>
<li>Apple MacBook</li>
</ul>
<h3>Vorgehensweise</h3>
<p>Nachdem die Software auf der virtuellen Maschine installiert war, habe ich den Remotedebugger auf dem Server mit den ASP.NET-Anwendungen installiert und als Dienst gestartet.</p>
<h3>Firewallkonfiguration</h3>
<p>In der Windows-Firewall muss auf dem Host das Progamm Microsoft Remotedebugger, auf dem Client das Programm Microsoft Visual Studio als Ausnahmen deklariert sein, bzw. in einer Firewall müssen die folgenden Ports geöffnet sein:</p>
<ul>
<li>TCP 139</li>
<li>TCP 445</li>
<li>UDP 137</li>
<li>UDP 138</li>
</ul>
<p>Sollten Sie IPSec benutzen müssen, benötigen Sie auch die folgenden Ports:</p>
<ul>
<li>UDP 4500</li>
<li>UDP 500</li>
</ul>
<h3>Fehlermeldung</h3>
<p>Als ich brav alles eingestellt hatte, quittierte mir das System meine Debugging-Bemühungen mit folgender Fehlermeldung:</p>
<pre>Unable to start debugging on the web server. The Visual Studio
debugger cannot connect to the remote computer. A firewall may
be preventing communication via DCOM to the remote computer.
Please see Help for assistance.</pre>
<div id="attachment_210" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-210" title="Remotedebugging - Unable to start debugging on the web server" src="http://pmdmedia.wordpress.com/files/2009/11/remotedebugging1.jpg" alt="Remotedebugging - Unable to start debugging on the web server" width="450" height="203" /><p class="wp-caption-text">Remotedebugging - Unable to start debugging on the web server</p></div>
<p>Diese Fehlermeldung blieb mir selbst bei der Ausschaltung sämtlicher Firewalls erhalten.</p>
<h3>Lösung</h3>
<p>Der Trick: Mein Netzwerk-Adapter in der Parallels-Maschine war auf &#8220;Shared&#8221; einstellt und hatte so eine IP, die in einem anderen Netzwerkbereich lag. Da der Domänencontroller diesen nicht kannte, konnte der Microsoft Visual Studio Remotedebugger keine Verbindung zu der Client-Maschine aufbauen.<br />
Setzen Sie den Modus für den Adapter auf &#8220;Bridged&#8221;. Dann wird es als eigenständige Netzwerkkarte betrachtet und bekommt vom DHCP-Server der Domäne eine eigene IP. Mit dieser kann sich der Remotedebugger dann auch connecten.</p>
<p>Wenn Sie Fragen, Anregungen oder Wünsche zu weiteren Themen in diesem Bereich haben, nutzen Sie bitte die Kommentare. Ich freue mich auf Ihre Feedback&#8230;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Microsoft Remotedebugging - Unable to Start Debugging on the Web Server ]]></title>
<link>http://blog.pmd-media.com/2009/11/06/microsoft-remotedebugging-unable-to-start-debugging-on-the-web-server/</link>
<pubDate>Fri, 06 Nov 2009 16:23:06 +0000</pubDate>
<dc:creator>Frank Piotrowsky</dc:creator>
<guid>http://blog.pmd-media.com/2009/11/06/microsoft-remotedebugging-unable-to-start-debugging-on-the-web-server/</guid>
<description><![CDATA[Die ASP.NET-Anwendungen eines Microsoft Internet Information Server 7.0 (IIS 7) ließen sich in der D]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Die ASP.NET-Anwendungen eines Microsoft Internet Information Server 7.0 (IIS 7) ließen sich in der Domäne nicht remote debuggen. Es kam die Meldung:</p>
<pre>Unable to Start Debugging on the Web Server. Das System kann die
angegebene Datei nicht finden.</pre>
<p>Die Meldung (halb englisch, halb deutsch) wurde vom Microsoft Visual Studio 2010 Beta 2 Remotedebugger ausgegeben. Daher wahrscheinlich der Sprachenmix.</p>
<h3>Lösung</h3>
<p>Der IIS muss die Integrierte Windows-Authentifizierung aktiviert haben. Danach lief alles so, wie es sollte.</p>
<p>&#160;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[IIs7 wcf configuration]]></title>
<link>http://dotnettrails.wordpress.com/2009/11/06/iis7-wcf-configuration/</link>
<pubDate>Fri, 06 Nov 2009 16:21:07 +0000</pubDate>
<dc:creator>dotnettrails</dc:creator>
<guid>http://dotnettrails.wordpress.com/2009/11/06/iis7-wcf-configuration/</guid>
<description><![CDATA[If you are seeing 404- file not found error for your favorite svc file on IIS7 execute this in comma]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>If you are seeing 404- file not found error for your favorite svc file on IIS7</p>
<p>execute this in command prompt</p>
<p align="left">C:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe -i</p>
<p>Yeppie… your svc files work like charm <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[ReportViewer Issue on IIS7 (After Migrating from IIS6)]]></title>
<link>http://devmanic.wordpress.com/2009/11/02/reportviewer-issue-on-iis7-after-migrating-from-iis6/</link>
<pubDate>Tue, 03 Nov 2009 00:23:26 +0000</pubDate>
<dc:creator>Drew</dc:creator>
<guid>http://devmanic.wordpress.com/2009/11/02/reportviewer-issue-on-iis7-after-migrating-from-iis6/</guid>
<description><![CDATA[After migrating a web application from IIS6 to IIS7 I experienced issues with the ReportViewer rende]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>After migrating a web application from IIS6 to IIS7 I experienced issues with the ReportViewer rendering incorrectly and incompletely. Google and Antonio Ooi to the rescue with an easy fix that required just a bit of web.config editing&#8230;</p>
<p><a href="http://otkfounder.blogspot.com/2007/11/solving-reportviewer-rendering-issue-on.html">OTK Founder&#8217;s Column: Solving ReportViewer Rendering Issue on IIS7</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[IIS 7, FastCGI e PHP - Prestazioni]]></title>
<link>http://pianetaemme.wordpress.com/2009/10/29/iis-7-fastcgi-e-php-prestazioni/</link>
<pubDate>Thu, 29 Oct 2009 14:21:47 +0000</pubDate>
<dc:creator>adeangelis84</dc:creator>
<guid>http://pianetaemme.wordpress.com/2009/10/29/iis-7-fastcgi-e-php-prestazioni/</guid>
<description><![CDATA[Oggi ho deciso di parlare un pò dell&#8217;integrazione di PHP su Windows, e più precisamente su Win]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Oggi ho deciso di parlare un pò dell&#8217;integrazione di PHP su Windows, e più precisamente su Windows 2008 Server e IIS7. Molti vedono come un oltraggio questa integrazione, ma tant&#8217;è ne esiste la possibilità, vuoi perché magari i clienti finali che non vogliono sentir parlare (a torto) di sistemi Linux, oppure vuoi perchè da parte di Microsoft c&#8217;è stata un&#8217;apertura verso l&#8217;open-source, come ad esempio l&#8217;accordo con la società israeliana ZEND, da anni sostenitrice del progetto PHP, dobbiamo trovare assolutamente una soluzione per utilizzare al meglio il nostro server web..</p>
<p>Nell&#8217;articolo di oggi, non parlerò del funzionamento di PHP o di IIS7, bensì di un tema solo in parte trattato, tra i più importanti, ovvero il concetto delle <strong>prestazioni</strong>.</p>
<p>Per chi presta la propria attività presso un cliente, diciamo medio grande, e si occupa di un qualsiasi progetto web nel quale si faccia uso di PHP su sistemi Windows, si imbatterà prima o poi nella fase di test e collaudo prestazionale, e di certo non si potrà nascondere nel momento che l&#8217;omino dei test urlerà ai quattro venti che i nostri server non superano le 300 request al secondo.</p>
<p>Ed allora andiamo ad analizzare nel dettaglio tutte le piccole migliorie che possiamo apportare ai nostri server.</p>
<p>Il nostro ambiente di riferimento sarà:</p>
<p>Windows server 2008<br />
IIS7<br />
FastCgi<br />
PHP 5.3 thread-safe (complichiamo la faccenda)<br />
Lib PECL</p>
<p>Personalmente, se non siete masochisti come me, vi consiglio l&#8217;uso del pacchetto PHP Zend-Core di Zend appunto, che porta al suo interno moltissime personalizzazioni di PHP per convivere con windows.</p>
<p>Inoltre è consigliato l&#8217;utilizzo di PHP in modalità NON-thread Safe, ma se avete applicazione che richiedono il thread-safe allora continuate a leggere.</p>
<p>Dunque prendiamo atto che già disponete di IIS7 installato e del modulo FastCGI attivato(In windows 2008 il modulo FastCGI è integrato in IIS7, quindi non occorre scaricarlo come pacchetto aggiuntivo).</p>
<p> Installate la vostra versione di PHP. Di default dovrebbe installarsi all&#8217;interno della root C (C:\PHP).</p>
<p>Per non prolungarmi troppo, do per scontato che siete in grado di creare un sito e di creare un’ application pool che punta al nostro PHP utilizzando FastCGI</p>
<p>Come prima cosa andiamo ad editare alcuni parametri di configurazione del modulo FastCGI di IIS7.</p>
<p>Nella consolle di gestione di IIS (IIS 7 Manager), selezioniamo <strong>FastCGI Settings:</strong></p>
<p style="text-align:center;"><strong> <img class="aligncenter size-full wp-image-8" title="2" src="http://pianetaemme.wordpress.com/files/2009/10/2.png" alt="FastCgi Settings" width="459" height="347" /></strong></p>
<p>Facciamo doppio click sull’appication FastCGI  per visualizzare e modificare i valori impostati di default.</p>
<p style="text-align:center;"> </p>
<div id="attachment_9" class="wp-caption aligncenter" style="width: 470px"><img class="size-full wp-image-9" title="3" src="http://pianetaemme.wordpress.com/files/2009/10/3.png" alt="Enviroment Variable FastCgi" width="460" height="308" /><p class="wp-caption-text">Enviroment Variable FastCgi</p></div>
<p>Qui dobbiamo fare attenzione a due campi:</p>
<ol>
<li><strong>MaxInstance=4;              </strong>Questo campo di default è impostato a 4, ed indica il numero di processi php-cgi.exe contemporanei possono essere gestiti dal nostro server. Questo valore può essere portato fino a 32, a seconda della potenza computazionale della nostra macchina.<strong> <br />
</strong>Nel caso avessimo un quad-core esso distribuirà autonomamente le istanze su tutti e 4 i core. Più Istanze possono essere eseguite e più veloci saranno le risposte del server alle nostre chiamate. </li>
<li><strong>InstanceMaxRequest= 200        </strong>Di default il valore di questo campo è impostato a 200, ed anche questo è variabile a seconda della potenza del server. Da Best Practices Microsoft è consigliato alzare questo valore senza però compromettere l’affidabilità dell’applicazione, viene consigliato comunque di impostarlo a circa 10000 istanze, in ogni caso questo valore deve essere minore o uguale al valore della variabile <strong>PHP_FCGI_MAX_REQUESTS.<br />
</strong>Questa variabile, che non è presente in elenco è di default impostata con il valore 500, sarà nostra cura editarla ed impostare anch’essa al valore 10000. Vediamo come:<br />
clicchiamo su <strong>Enviroment Variables </strong>e cliccando sul pulsante <strong>Add </strong>aggiungiamo la variabile con il nome <strong>PHP_FCGI_MAX_REQUESTS </strong>e come valore digitiamo <strong>10000.</strong></li>
</ol>
<p style="text-align:center;"><strong> </strong><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong>Chiudiamo la parte relativa alla configurazione del modulo FastCGI e passiamo alla configurazione della cache di IIS7</p>
<p>Ebbene, IIS7 a differenza dei suoi predecessori presenta un nuovo tipo di cache chiamata UserMode oltre alla sempre presente Kernel Mode. Entrambe fanno riferimento ad un modulo chiamato Output Caching.</p>
<p>Grazie a questa introduzione, potremo utilizzare la cache di IIS anche per le applicazioni scritte in PHP, ovviamente per ASP.NET ci sono tutta una seria di Pipeline che sfrutta a pieno questa funzionalità.</p>
<p>Considerate che in presenza di contenuti statici, ad esempio immagini, si arriva a moltiplicare 10 volte il numero delle request/sec elaborate dal nostro server.</p>
<p>Di seguito vi elenco i parametri consigliati per la cache del nostro ambiente PHP: </p>
<p>Sempre all’interno di IIS, selezioniamo il nostro Sito, e facciamo doppio click sul modulo <strong>Output Caching</strong>.</p>
<p>Sulla destra in alto facciamo click su <strong>Add </strong>ed aggiungiamo la nostra regola per la cache.</p>
<p> In figura i dati da inserire in  configurazione:</p>
<p style="text-align:center;"> </p>
<div id="attachment_11" class="wp-caption aligncenter" style="width: 470px"><img class="size-full wp-image-11" title="5" src="http://pianetaemme.wordpress.com/files/2009/10/5.png" alt="Output caching iis7" width="460" height="407" /><p class="wp-caption-text">Output caching iis7</p></div>
<p> Facciamo click su <strong>Advanced </strong>e spuntando la checkbox <strong>Query String Variables </strong>inseriamo semplicemente un “*” per accettare ogni cosa,oppure possiamo inserire i valori a nostro piacimento.</p>
<p> Salviamo il tutto, e passiamo al fine tuning del php.ini del nostro server.</p>
<p> Per quanto riguarda il php.ini, ovviamente vanno effettuate tutte le configurazione delle quali avrà bisogno la nostra o le nostre applicazioni, ci sono comunque una serie di parametri (alcuni comuni anche alla versione Zend) che sarebbe opportuno rispettare per un miglioramento delle performance. Ovviamente non tutte sono applicabili in tutti i casi, anche in queste configurazioni occorre tenere conto della configurazione hardware del nostro server.</p>
<p> Per praticità riporto una tabella che potete trovare al seguente link:</p>
<p> <a href="http://files.zend.com/help/Zend-Server-Community-Edition/configuring_php_for_performance.htm">http://files.zend.com/help/Zend-Server-Community-Edition/configuring_php_for_performance.htm</a></p>
<p> Per effettuare un test prestazionale potete utilizzare il tool Microsoft Wcat integrato anche nel resourcekit iis 6.</p>
<p>Un esempio pratico di test: <a href="http://blogs.iis.net/bills/archive/2006/10/31/PHP-on-IIS.aspx">http://blogs.iis.net/bills/archive/2006/10/31/PHP-on-IIS.aspx</a></p>
<p>Ebbene con queste poche e pratiche modifiche, il sito da me utilizzato per i test, è passato da 1300 Request/Sec  a  3800 Request/Sec.</p>
<p>Sono ovviamente graditi commenti o rettifiche al testo</p>
<p>Alla prossima</p>
<p>Alessandro</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Fun and Games with IIS7 and Tomcat Connector (Jakarta)]]></title>
<link>http://dannybaggs.wordpress.com/2009/10/15/fun-and-games-with-iis7-and-tomcat-connector-jakarta/</link>
<pubDate>Thu, 15 Oct 2009 21:33:28 +0000</pubDate>
<dc:creator>dannybaggs</dc:creator>
<guid>http://dannybaggs.wordpress.com/2009/10/15/fun-and-games-with-iis7-and-tomcat-connector-jakarta/</guid>
<description><![CDATA[I needed to run Tomcat behind IIS and delegate html page requests as well as xml page requests from ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I needed to run Tomcat behind IIS and delegate html page requests as well as xml page requests from IIS 7 through to Tomcat.</p>
<p>As I had done this a number of times with IIS6 and Helicon&#8217;s rewrite tool, I thought this would be easy&#8230; Oh no.  I was wrong.</p>
<p>Therefore, here are a few things to be aware of:</p>
<ul>
<li>Make sure you have installed the Tomcat Connector OK.  I found this site to be useful here for the Tomcat Connector install on IIS 7: <a href="http://www.iisadmin.co.uk/?p=72">http://www.iisadmin.co.uk/?p=72</a></li>
<li>Install the &#8216;URL Rewrite&#8217; module within IIS 7.  I didn&#8217;t do this myself, not because it was difficult&#8230; I just simply didn&#8217;t do it and would guess there is enough info on how to do this.</li>
<li>Configure all rewrite rules at the server level and not at the individual site level.  This is because there is some issue around chaining an HTTP request through an ISAPI filter like the Tomcat Connector and then the URL rewrite module or vice versa.  I even tried another ISAPI based rewriter like the one from Helicon (http://www.helicontech.com) resulting in the same challenge that the rewrites and redirect (delegation &#8211; not to be confused with a 301 type redirect) worked independentlybut not together.</li>
<li>The syntax for the rewrite rules is different from Apaches mod_rewrite &#8211; e.g:</li>
</ul>
<ol>
<li><strong>^/?.*/(.+\.html?)$</strong> would normally handle input urls like /index.htm or /level1/level2/index.htm but this was not liked by the URL Rewrite module in IIS 7.  What worked instead was <strong>([^/]+\.html?)</strong>.</li>
<li>Remember to use <strong>{R:1}</strong> syntax for getting the back references instead of <strong>$1</strong> etc.</li>
<li>Remember to use conditions if you have multiple sites in the same instance utilising the <strong>{HTTP_HOST}</strong> and <strong>{SERVER_PORT}</strong> strings.</li>
</ol>
<p>Let me know if you found this useful or if there are other useful references to add into this.  I personally found it difficult to dig up something similar.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Security Exception when using AJAX Control Toolkit on Server 2008]]></title>
<link>http://computermutt.wordpress.com/2009/10/02/security-exception-when-using-ajax-control-toolkit-on-server-2008/</link>
<pubDate>Sat, 03 Oct 2009 00:50:42 +0000</pubDate>
<dc:creator>Mike Malter</dc:creator>
<guid>http://computermutt.wordpress.com/2009/10/02/security-exception-when-using-ajax-control-toolkit-on-server-2008/</guid>
<description><![CDATA[I am using the AJAX Control Toolkit for its tab UI and my compile and link cycles came and went with]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I am using the AJAX Control Toolkit for its tab UI and my compile and link cycles came and went without incident on my Vista development machine.  However when I deployed to our integrated unit test environment on Server 2008, I got the following error when accessing the page with tabs:</p>
<p style="padding-left:30px;">System.Security.SecurityException: Request for the permission of type &#8216;System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&#8242; failed.  Here is a screen shot for reference.</p>
<p><img class="aligncenter size-full wp-image-372" title="SecurityException" src="http://computermutt.wordpress.com/files/2009/10/securityexception.png" alt="SecurityException" width="670" height="746" /></p>
<p>I did a lot of checking and I found articles that involved accessing the AJAX Control Toolkit on a different machine, but that was not my issue.  After publishing via Visual Studio to our server, all dll&#8217;s were in their normal folders.</p>
<p>The solution was to change one of the defaults on the application pool for this website.  The value is under the Process Model section in Advanced Settings and is Load User Profile.  By default it is set to false which will emulate IIS6 behavior of not loading the user profile for the application pool identity.  Setting it to true solved the problem.</p>
<p><img class="aligncenter size-full wp-image-374" title="TheFix" src="http://computermutt.wordpress.com/files/2009/10/thefix.png" alt="TheFix" width="545" height="970" /></p>
<p>That was it.  Make sure you recycle your application pool and restart your web site.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Using an External Config File With log4net with ASP.NET 2.0 and IIS7]]></title>
<link>http://blog.palehorse.net/2009/09/29/using-an-external-config-file-with-log4net-with-asp-net-2-0-and-iis7/</link>
<pubDate>Tue, 29 Sep 2009 18:12:00 +0000</pubDate>
<dc:creator>palehorse</dc:creator>
<guid>http://blog.palehorse.net/2009/09/29/using-an-external-config-file-with-log4net-with-asp-net-2-0-and-iis7/</guid>
<description><![CDATA[I started a new project recently and set about adding log4net to it.&#160; I’d upgraded to a new Win]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I started a new project recently and set about adding log4net to it.&#160; I’d upgraded to a new Window 7 workstation over the past month whereas I’d previously been using XP, so the step up to IIS7 was exciting and and a bit anxious all at the same time.&#160; My first hurdle so far has been using log4net.</p>
<p>I tend to be the type of person that likes to separate out the log4net configuration into it’s own file, usually log4net.config.&#160; Setting up this new project; however, I started running into a problem I’d never seen before.&#160; When trying to use the XmlConfiguratior to read my log4net.config, I would see this exception:</p>
<blockquote><p>[SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.] </p>
</blockquote>
<p>Searching for others with this problem has not yielded much success.&#160; I’ve seen articles stating that it’s an issue with medium trust security (on m local workstation trust was set to full) to problems with some sort of <a title="Log4net And External Configuration File in ASP.NET 2.0" href="http://haacked.com/archive/2006/08/08/Log4NetAndExternalConfigurationFileInASP.NET2.0.aspx" target="_blank">breaking code within log4net</a> itself.&#160; Most of these articles I suspect were not using IIS7, but it was hard to tell.</p>
<p>I ended up digging into the log4net source code to find out what was happening.&#160; The problem would occur on a line of code that tried to access the FullName property of a System.IO.FileInfo object.&#160; That property threw the exception worked fine it I tried to access it from my web project, but once it got down into the log4net guts, it would not.</p>
<p>After a lot of frustration, I finally started looking elsewhere.&#160; I ran across a <a title="Log4Net &#34;Could not find schema information&#34; messages" href="http://stackoverflow.com/questions/174430/log4net-could-not-find-schema-information-messages" target="_blank">comment on Stack Overflow</a> that stated they used .xml instead of .config files.&#160; I had dismissed it due since others claimed .config files where fine, but recalling what I’d seen there I decided to try it.&#160; <strong>*Poof*</strong> it worked!</p>
<p>I didn’t really want to leave the configuration in a file with the .xml extension since that could easily be downloaded from a server.&#160; The discovery told me that it was likely due to something IIS was doing with ASP.NET to hide files, but the odd thing was that it could read from the web.config, so I was a little perplexed.&#160; I started digging into how IIS7 handles these types of protected files.&#160; </p>
<p><a href="http://palehorse.files.wordpress.com/2009/09/image4.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;margin:0 10px 0 0;" title="IIS7 Manager" border="0" alt="IIS7 Manager" align="left" src="http://palehorse.files.wordpress.com/2009/09/image_thumb4.png?w=98&#038;h=124" width="98" height="124" /></a>It turns out that there’s a section in the hosting configuration that lists protected files under the name “requestFiltering”.&#160; Hmm…that was an interesting sounding name.&#160; Unfortunately all the entries were only by file extension, not by file name directly so there had to be something else.</p>
<p><a href="http://palehorse.files.wordpress.com/2009/09/image5.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;margin:0 0 0 10px;" title="Request Filtering" border="0" alt="Request Filtering" align="right" src="http://palehorse.files.wordpress.com/2009/09/image_thumb5.png?w=244&#038;h=105" width="244" height="105" /></a>I ended up in the IIS7 Manager application and found the Request Filtering area.&#160; I began to poke around in there and discovered another tab called <strong>Hidden Segments</strong> which had an entry for the web.config!&#160; I clicked the <strong>Add Hidden Segment</strong> link under Actions and added a new entry for log4net.config and viola, my application worked!</p>
<p>I know that most of the IIS7 configuration settings are stored in various config files, including the web.config, so I started looking in there and found this new element in the &#60;<strong>system.webServer&#62;</strong> section.</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:61.48%;font-family:&#39;direction:ltr;height:134px;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:58.37%;font-family:&#39;direction:ltr;height:114px;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:94.94%;font-family:&#39;direction:ltr;height:16px;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">security</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:95.64%;font-family:&#39;direction:ltr;height:16px;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>     <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">requestFiltering</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:95.66%;font-family:&#39;direction:ltr;height:16px;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>         <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">hiddenSegments</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:96.18%;font-family:&#39;direction:ltr;height:16px;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>             <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">add</span> <span style="color:#ff0000;">segment</span><span style="color:#0000ff;">=&#34;log4net.config&#34;</span> <span style="color:#0000ff;">/&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>         <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">hiddenSegments</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:96.14%;font-family:&#39;direction:ltr;height:16px;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">requestFiltering</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:94.59%;font-family:&#39;direction:ltr;height:16px;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span> <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">security</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></div>
</div>
<p>I believe that including this section will allow the files to work.&#160; I even changed my trust level in my dev environment to Medium and it still ran just fine.</p>
<p>There may be other things that can cause this sort of problem, but this fixed my example.&#160; Hopefully this helps someone else out there as it was a bear to track down!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA['sys' undefined mit Telerik AJAX Framework auf IIS7/W2008]]></title>
<link>http://dotlab.wordpress.com/2009/08/27/sys-undefined-mit-telerik-ajax-framework-auf-iis7w2008/</link>
<pubDate>Thu, 27 Aug 2009 12:57:51 +0000</pubDate>
<dc:creator>dotlab</dc:creator>
<guid>http://dotlab.wordpress.com/2009/08/27/sys-undefined-mit-telerik-ajax-framework-auf-iis7w2008/</guid>
<description><![CDATA[Beim Rollout einer kleinen Webapplikation auf einen Windows 2008 Server mit IIS7 funktionierte das c]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Beim Rollout einer kleinen Webapplikation auf einen Windows 2008 Server mit IIS7 funktionierte das client-seitige AJAX Framework nicht, ein Javascript Error &#8217;sys is undefined&#8217; sorgte dafür, dass die App unbrauchbar wurde. Mit dem in VisualStudio 2008 integrierten Development Server klappte alles prima und sämtliche Tests auf allen möglichen Browsern liefen sauber durch. </p>
<p>Ich vermutete ein Problem mit dem Handler und setzte den verwalteten Pipelinemodus des Application Pools im IIS7 auf Classic und voilà: der Fehler tauchte nicht mehr auf. Ein bisschen Recherche im Netz brachte dann die Lösung: im integrierten Modus muss manuell ein verwalteter Handler angelegt werden. Das funktioniert so:</p>
<p>+ Klick auf die App<br />
+ Klich auf Handlerzuordnungen<br />
+ Verwalteten Handler hinzufügen<br />
+ Pfad: Telerik.Web.UI.WebResource.axd<br />
+ Typ: Telerik.Web.UI.WebResource<br />
+ Name: Telerik.Web.UI.WebResource</p>
<p>Nachdem der Handler nun manuell registriert wurde, funktionierte die App reibungslos!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[A Practical Architecture for WCF – Part 3]]></title>
<link>http://computermutt.wordpress.com/2009/08/26/a-practical-architecture-for-wcf-part-3/</link>
<pubDate>Wed, 26 Aug 2009 20:01:35 +0000</pubDate>
<dc:creator>Mike Malter</dc:creator>
<guid>http://computermutt.wordpress.com/2009/08/26/a-practical-architecture-for-wcf-part-3/</guid>
<description><![CDATA[This is the third article in our WCF practical architecture series.  Part 1 is here, and part 2 is h]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>This is the third article in our WCF practical architecture series.  <a title="A Practical Architecture for WCF - Part 1" href="http://computermutt.wordpress.com/2009/08/20/a-practical-architecture-for-wcf-part-1/">Part 1 is here</a>, and <a title="A Practical Architecture for WCF - Part 2" href="http://computermutt.wordpress.com/2009/08/24/a-practical-architecture-for-wcf-part-2/">part 2 is here</a>.</p>
<p>At a certian point, setting up a WCF environment moves you away from programming and more toward networking.  That is what this article is going to cover, how to setup a WCF client on IIS7 using the net.tcp protocol.  We will be crossing machine and domain boundaries and will be suggesting a starting point for a secure environment.</p>
<p>We are going to do  two things in this post</p>
<ol>
<li>Configure your local development machine to host a service in IIS7</li>
<li>Configure a seperate server to host a service in IIS7 and to recieve what you push from your local development machine.</li>
</ol>
<p>First, lets get service hosting done on your local machine so you have something to push to your application server.  Right click on your solution and then Add and then New Web Site.  Then select WCF Service as shown in the image below.  I choose the name CheeseListIISHostedServices.  It&#8217;s important now to pick the name you will be living with because I am recommending that this name not only be the name of your local environment, but the name of the new A record you will create to point to your application server.</p>
<p><img class="aligncenter size-full wp-image-322" title="HostingLocallyCreateIIS" src="http://computermutt.wordpress.com/files/2009/08/hostinglocallycreateiis.png" alt="HostingLocallyCreateIIS" width="670" height="741" /></p>
<p>Then in the AppCode folder delete the IService.cs and Service.cs files as you won&#8217;t need them because you have a seperate service layer.  Next, right click your site and click on Add new ASP.NET folder, then click on Bin.</p>
<p>Change the name of the Service.svc folder to the name of your service.  Since my service is called BrandServices, I renamed it to that.  Then you will want to go into the svc file and change the Service attribute.  Make sure that you include the namespace of your service too.  Look at the image below for how I named my Service attribute in the svc file. </p>
<p><img class="aligncenter size-full wp-image-325" title="RenameSVCFile" src="http://computermutt.wordpress.com/files/2009/08/renamesvcfile1.png" alt="RenameSVCFile" width="670" height="442" /></p>
<p>Notice in the image above that the location has been removed from the original Service.svc.  We will not need this as we are going to establish a reference to the project that contains the services.  To establish a reference, right click on the web site and then click on Add Reference.  Go to the projects tab and then click on the project that has your services.  In this instance for me it is CheeseListServices as shown in the image below.</p>
<p><img class="aligncenter size-full wp-image-327" title="CreateReferences" src="http://computermutt.wordpress.com/files/2009/08/createreferences.png" alt="CreateReferences" width="670" height="747" /></p>
<p>When you click on ok, your Bin folder will get filled up with all of the referenced dll&#8217;s in your service project including your newley created services dll.  Then, after a few more configuration details, you&#8217;ll have something to push out to your real services environment.</p>
<p>The next step is to configure the web.config file.  The two things to remember about the web.config file supporting services.  First it functions as the config file for the modules from the site we are wrapping with services, so all of its settings should be there, and we also have the services section.  Let&#8217;s take a look at the system.serviceModel section in the web.config in the figure below to look at how to configure our service for net.tcp and to be discoverable.</p>
<p><img class="aligncenter size-full wp-image-335" title="WebConfig" src="http://computermutt.wordpress.com/files/2009/08/webconfig.png" alt="WebConfig" width="670" height="548" /></p>
<p>You can copy and past what is here and change the names to fit your names.  In the bindings section we have a netTcp binding tag.  There is more here than is necessary, but this binding section will support transactions and a certian level of security.  So for now just to get this running, this can be copyed and pasted.</p>
<p>In the services section we have three services, but two of them are collapsed because we won&#8217;t need them now, but we will later.  In the service for Brand services we set our binding protocol to net.tcp and we also included a few endpoints.  The mex endpoint is used by the client to generate service metadata. </p>
<p>Since we are not using http but net.tcp as the service protocol, we cannot put the mex endpoint address into a browser and read the file, but we will be using the WCF Test Client to make sure our setup is working.  Normally, I never use the WCF Test Client because I&#8217;ll always have a client around with some sort of functionality to get myself off of the ground.  But I didn&#8217;t want to make you wait until we got done with the client to see if you had set up your services correctly.  So we are using the client here.  This part of the series is pretty long as it is.</p>
<p>Finally in the config is the behavior section.  In the serviceBehaviors tag we have additional information for our service.  You can cut and paste here too making sure that you have your service name correct.</p>
<p>Next, please check to see if your default web site has a net.tcp binding type.  To check it, click on the default web site and then right click and then click on Edit Bindings.  You should see net.tcp for port 808:*.  If you don&#8217;t, click on the add button and add it.  Later on in this post, we go into setting up bindings on IIS7 on Windows Server 2008.  Anyway, when you setup IIS7 on your workstation, all bindings should have been created by default.</p>
<p>Ok, we are getting really close to fireing up our service.  We just have to get the address of our service to feed to the WCF Test Client and then we are good to go.  Here is how to do that.  In IIS7, click on the website that is hosting your services and then in the center pane at the bottom click on Content View.  Then find the svc file for your service, click on it and then click on browse.  You should get something in your browser like the figure below.</p>
<p><img class="aligncenter size-full wp-image-336" title="BrowserBrandServices" src="http://computermutt.wordpress.com/files/2009/08/browserbrandservices.png" alt="BrowserBrandServices" width="670" height="719" /></p>
<p>If you got this, you are really in good shape, that means your site is setup correctly and you do not have any gross errors in your config file.  What you want is the address up close to the top right after svcutil.exe.  Copy and then pull up the WCF Test Client at C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\WcfTestClient.exe.  When you get it up, click on File and then Add Service.  Past the address into the end point address edit box like the figure below. </p>
<p><img class="aligncenter size-full wp-image-337" title="WCFTestClient" src="http://computermutt.wordpress.com/files/2009/08/wcftestclient.png" alt="WCFTestClient" width="670" height="444" /></p>
<p>Then click on OK and after a bit you should see a dialog box appear with a progress bar saying &#8220;Adding&#8221;.  When finished you should see your service under My Service Projects along with the service method.  In the figure below, you can see my ListAll() method.  I clicked on the listAll() method and then got a ListAll panel on the right.  Then I clicked on the Start a new proxy checkbox near the Invoke button and then clicked on the Invoke button and got the result below (click through the security warning).</p>
<p><img class="aligncenter size-full wp-image-339" title="FirstBrandService" src="http://computermutt.wordpress.com/files/2009/08/firstbrandservice.png" alt="FirstBrandService" width="670" height="667" /></p>
<p>The results are the return of the BrandList object from the ListAll() service.  If you click on the XML tab on the bottom, you can see the Request and Response messages.  If you got this far, you are in really good shape.  If not, please post your questions and I&#8217;ll answer them asap.</p>
<p>The next part of this post explains how to create an application server using IIS7 and the net.tcp protocol in your enterprise.</p>
<p>Every enterprise has its own security requirements and what configuration is necessary to meet those requirements.  So, this article is not intended to be then end all and be all of security, however, for traffic within your LAN, it is my opinion that what we are talking about here will be reasonably secure.</p>
<p>Also, as pointed out earlier in this series, we&#8217;re not going into all the options available, but are pointing out one simple and practical approach.  Resources for a more detailed discussion of options are here.</p>
<p>Ok, now on to the client.  WCF services can either self host, or use IIS.  We are going to look at how to host WCF Services with IIS7.  We are also going to be using the net.tcp protocol to do it.  The reason to use net.tcp is that by doing so you can expose your services equally to a web site or to a windows forms application.  You can do it using http or https, but net.tcp is much faster, and although it is a little harder to configure, it is really worth it.</p>
<p>What we are doing here is to setup the service on its own machine and with its own domain.  First thing is to create the DNS domain internally.  The default domain on our network is joyousliving.com and we also use maltercorp.com equally.  The Windows domain name is joyousliving.com.  We also have a number of other domains as we host and do development for clients.  We created a new domain called maltercorplabs.com and are using it for hosting services.  However the windows forms desktop client is on the joyousliving.com domain.  Below is a screenshot of the maltercorplabs.com domain after it was configured with the cheeselistiishostedservices A record.</p>
<p><img class="aligncenter size-full wp-image-310" title="DNSConfiguration" src="http://computermutt.wordpress.com/files/2009/08/dnsconfiguration.png" alt="DNSConfiguration" width="649" height="500" /></p>
<p>The next step is to create the site on IIS7 that will do the hosting.  To that, first you have to add the IP address you want to use for the site into your NIC configuration.  I never use the default web site, and always add additional IP&#8217;s for each website I need.  The screen shot below shows the configuration of the NIC. </p>
<p>To get there you go to Control Panel / Network Connections and click on the NIC you want to configure.  Then click on the properties button and then on the Internet Protocol Version 4 item.  Then click on the advanced button and on the top of the dialog box, you&#8217;ll see IP addresses.  Add the IP there.  Aftering adding the IP, make sure you can ping it from your workstation using the fully qualified domain name you setup in the DNS Manager.  In this case it is CheeseListIISHostingServices.MaltercorpLabs.com.</p>
<p><img class="aligncenter size-full wp-image-314" title="IIS7IPAddress" src="http://computermutt.wordpress.com/files/2009/08/iis7ipaddress.png" alt="IIS7IPAddress" width="565" height="664" /></p>
<p>Next, create the actual site.  My convention is to create a site name that is the same as the A record I created.  Under binding make sure you pick the new IP Address you created and leave the rest to default values.  We are going to go back and change a few things.</p>
<p>After creating the website, create an application pool where the Managed Pibeline Mode is Integrated.  Now comes the fun and controversial part.  I change the identity in the Process Model section from the NetworkService to something else.  That identity is a regular windows login for each application.  Users don&#8217;t know anything about it, it&#8217;s purpose is to be an administrative or application service account.  This account is used as the identity of the website as well as the login to the database.  We use an SSPI login to talk to the database so we don&#8217;t have to embed a login id and password into the web.config.</p>
<p>So, lets talk about this for a bit.  What I want to do as an architect is balance security with maintenance and prevent deployment errors.  So, I have at least three and sometimes 4 environments.  Each environment will have a complete set of machines; database, web and or services.</p>
<ol>
<li>Development</li>
<li>Integrated Unit Test</li>
<li>QA</li>
<li>Production</li>
</ol>
<p>For each application in each environment, I will create a windows login.  In each database I create a database role and then assign the application service account to that role.  Each environment has the same database role, but each environment will have a different application service account.  This makes it very easy to migrate database changes between environments; from dev to IUT to QA and then to production.  I don&#8217;t have to make any manual changes to any script because I am granting permissions on the role in the database. </p>
<p>Then in any web environment where I am using SSPI logins, the identity in the application pool is what is used to login into SQL Server.  Sometimes when moving scripts around, it is possible and likely that you will at one time or another, you will point to a database in the wrong environment.  However having a different application service account for each environment will cause an exception to be thrown and you&#8217;ll know immediately that the name of the server is wrong.</p>
<p>The reason you need to care about the database login for the service is that we are wrapping an existing website&#8217;s dll&#8217;s and they need a way to login to the database.  You could if you wanted create a different application service account to be used by services from the one used by the website.  It does not matter as long as that user gets added to the appropriate database role in the right database and it is the same as the identity in the application pool.</p>
<p>It may seem like a lot of work to create so many users and to do this extra configuration, but you will be glad you did the moment your development process comes under stress.  Its much better to see an immediate error telling you that you tried to get into the wrong database, than to realize that you have been pointing to the wrong database and now your data is screwed up, not to say what will happen with your credibility with the users having to re-enter data and trying to remember what they did.</p>
<p>So, right click on the new application pool and then click on advanced settings and change the name of the Identity to your application service account as shown in the image below.</p>
<p><img class="aligncenter size-full wp-image-318" title="NewIdentity" src="http://computermutt.wordpress.com/files/2009/08/newidentity.png" alt="NewIdentity" width="634" height="1099" /></p>
<p>After changing your site&#8217;s identity, you need to add a binding to support net.tcp.  So, right click on the website that you are going to use to host the service and click on Edit Bindings.  Then click on the Add button, and like the image below shows, select net.tcp from the dropdown and enter a port number followed by an asterick.  I choose 808:*.  then click ok.</p>
<p><img class="aligncenter size-full wp-image-320" title="AddBinding" src="http://computermutt.wordpress.com/files/2009/08/addbinding.png" alt="AddBinding" width="596" height="580" /></p>
<p>Now the website is setup with its own application pool and custom binding and is ready to be published to.  So, lets put our programmer&#8217;s hat back on and open Visual Studio.  We want to change the base address and point to the website we just set up, so change it from localhost.  In my case the new address is net.tcp://CheeseListIISHostedServices.MaltercorpLabs.com/.  Once you are done with the configuration changes, then go ahead and publish to your new server.  You can test it just like you did when you were getting services to run for the first time on your local machine.</p>
<p>Ok, that is it for this part.  There was a lot here, and I know this piece stayed pretty high level.  Remember there are <a title="Highly Recommended WCF Learning Resources" href="http://computermutt.wordpress.com/2009/05/06/highly-recommended-wcf-learning-resources/">WCF Learning Resources here </a>on the Computer Mutt.  Also, if you have any questions, post them and I&#8217;ll answer them ASAP.  Next up we will create a web and windows forms client.  After that we will dive into transactions and then to exception handling.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[A Practical Architecture for WCF - Part 2]]></title>
<link>http://computermutt.wordpress.com/2009/08/24/a-practical-architecture-for-wcf-part-2/</link>
<pubDate>Mon, 24 Aug 2009 19:36:46 +0000</pubDate>
<dc:creator>Mike Malter</dc:creator>
<guid>http://computermutt.wordpress.com/2009/08/24/a-practical-architecture-for-wcf-part-2/</guid>
<description><![CDATA[This article follows A Practical Architecture for WCF &#8211; Part 1. Whew, well finally (no really)]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a title="A Practical Architecture for WCF - Part 1" href="http://computermutt.wordpress.com/2009/08/20/a-practical-architecture-for-wcf-part-1/">This article follows A Practical Architecture for WCF &#8211; Part 1</a>.</p>
<p>Whew, well finally (no really) some code! </p>
<p>I created an empty solution called CheeseList_3_0_0_x and created all of my projects inside of it.  Call it whatever you want.  In my solution I created a project for my services called CheeseListServices and then created three services, one each for Brands, CheeseTypes and Links. </p>
<p>I structured my project so that each service was in its own folder.  I did this so that nothing happens by default.  What I mean by that is that all the examples presented by books and blogs just show one service, but, most projects will have more than one service and it took me a long time (blush) to figure out how to do this in an industrial strength way, so I am starting you out that way in the beginning.</p>
<p>The steps to do this after creating your blank solution is to highlight the solution and then add and then new project.  Since we are coding in C# here, under the Visual C# header in the Project types list click on WCF and then click on WCF Service Library.  I named mine CheeseListServices.</p>
<p><img title="Create Services Project" src="http://computermutt.wordpress.com/files/2009/07/createservicesproject.png" alt="Create Services Project" width="670" height="571" /></p>
<p>After creating your Service project, please delete the Service1.cs and IService1.cs files in the root of the project that were created by default.  Leave App.config alone for now.  Then, create a few folders for your services.  We are mostly going to only use one, but the other services will have one or two methods in them so you can tell for sure that everything is setup correctly and what you are calling is actually answering.  After you have created your folders, create the services you&#8217;ll be using, one service to a folder so that everything that relates to that service is in one place.</p>
<p>To create your services, click on the folder in your services project and then goto add and then new item.  In the Templates window click on WCF Service.   Give it a name that makes sense to you.</p>
<p><img title="Create Services" src="http://computermutt.wordpress.com/files/2009/07/createservices.png" alt="Create Services" width="670" height="683" />  </p>
<p>You&#8217;ll notice that only two files were created, one will house service interfaces and the other will house the actual services.  We are going to need to add a third for data contracts.</p>
<p>In your references section add a reference to System.ServiceModel and make sure that you have a using statement for it in all of your services files.  In addition, since I am wrapping an existing website I also added references to my datalayer, businesslayer and common dll&#8217;s from that project.  The next step is to create the data contract to support your first example. </p>
<p>I chose the most simple, non-transactional, routine with no parameters I could think of to start small and that was to return a list of all brands.  The business layer of the site has a brand object with a ListAll() method with no parameters, so this is my starting point.   I would pick something very simple with no parameters or transactions and that returns something simple, like a list.</p>
<p>My data contracts for BrandServices is in a file called BrandDataContracts.cs.  At this point please create a data contract that will contain the types in your service.  Lets take a look at a snippet of code from my data contracts file for the Brand service, and walk through what is there and why.  Basically I am going to want to return a list of brands that will contain an numeric ID of a brand and a label.  There is much more to this file that we will go through later.</p>
<p><img class="aligncenter size-full wp-image-275" title="BrandListDataContract" src="http://computermutt.wordpress.com/files/2009/08/brandlistdatacontract2.png" alt="BrandListDataContract" width="670" height="903" /></p>
<p>Let&#8217;s take a look at what we did.</p>
<p>We created an object called BrandList and decorated it with the DataContract attribute.  And as a parameter to that attribute, we are providing a string that is formatted with the URL of the service, the service type and then a year and a month.  This string will uniquely identify the service in metadata so think this through carefully as it will be very helpful to have something structured that will allow you to uniquely identify your data contracts as well as something that can indicate when they were created.</p>
<p>Next we have our private properties just like any object.  Here we created properties for a brand id, a label and an error level.</p>
<p>For constructors, we are allowing the creation of an a BrandList object with or without parameters.  Each constructor is also calling an init method we will use to set default and other values.  In this case we are setting the default value of the error level to an init status &#8211; that is neither success or fail.</p>
<p>In the public properties section, we are exposing our private properties through get/set variables and then are decorating each with a Name, Order and IsRequired.  This decoration is important because it is used in meta data when the objects properties are exposed.  If you do not list an order, properties will be displayed in alpha order which may not be the best way.   IsRequired is important because if something is set as IsRequired equals true and it is not present, an exception will be thrown.  When IsRequired equals false, the variable is optional.</p>
<p>That&#8217;s it &#8211; we have created our first data contract.  Now lets go and write the service.</p>
<p>Open the interface file for your service.  In my case its IBrandServices.cs.  We are going to create an interface for our Brand service and will expose a method to list all brands, or ListAll().  Please refer to the image below.</p>
<p><img class="aligncenter size-full wp-image-280" title="BrandListOperationContract" src="http://computermutt.wordpress.com/files/2009/08/brandlistoperationcontract.png" alt="BrandListOperationContract" width="670" height="317" /></p>
<p>Lets look at what we did and why.</p>
<p>In our namespace, it&#8217;s just like before with our data contract with one difference.  In this case we are creating a Service Contract. </p>
<p>The one method we want to expose at this point in our service will be that list of all brands, so here we create an interface for a ListAll() method that returns a List&#60;BrandList&#62;.  The BrandList type in our List&#60;&#62; is the object we created in our data contract.</p>
<p>Next, lets create the actual service.  In my case I created a BrandServices.cs file.  Let&#8217;s take a look and see what was done.</p>
<p> <img class="aligncenter size-full wp-image-283" title="BrandListService" src="http://computermutt.wordpress.com/files/2009/08/brandlistservice.png" alt="BrandListService" width="670" height="656" /></p>
<p>We created a public object called BrandServices and derived it from our interface IBrandServices.  We have one public method called ListAll() that returns a List&#60;BrandList&#62;.  The first thing we do is to create a new brand object of type List&#60;BrandList&#62; and then call the ListAll() method in the business layer of the existing web site.</p>
<p>Since that application has been a self contained web site, we used DataTables for passing our data around.  This is not a problem because all of the .NET controls can data bind to them.  However DataTables will not work for services.  We need strongly typed data. </p>
<p>Let&#8217;s take a step back for a minute to understand why we need strongly typed data.  One of the crown jewels of using WCF to implement services is in the mechanism for a standard in the creation of metadata files that can be consumed by any application using our service, or in a word, interoperability.  That is, you could write services in .NET and they can be consumed by a Java app or vice versa.  But the calling application must have a way to find your service and then to understand the details of your service, operation, data and fault contracts.</p>
<p>I don&#8217;t want to get too deep here as the references linked to the first post in this series cover this in detail, but when we look at the metadata for the return value for the List&#60;BrandList&#62; it is seen as a BrandList[].  One side of the service can use all of its types but as long as they are translated and handled by metadata the calling application can consume them.</p>
<p>One more aspect of types.  There is a generic type of collection available in the ServiceModel namespace that you can use instead of List&#60;&#62;.  This is valuable because the program using the service may not know what a List&#60;&#62; is but needs a collection it can insert objects into to pass them back to you.  We&#8217;ll get into this a little later, but if you create a data type based on an ObservableCollection&#60;&#62;, the client can create that type, fill it and send it back.</p>
<p>Ok, back to our code.  After checking the error level and row count from the call to the ListAll() method exposed by the original business layer, for each data row in the returned data table, we are creating a new BrandList object and adding it to the brands list.  If we do not throw an exception, we return the brands list.</p>
<p>For now I am going to skip exception handling, but will get back to it later after we get this service working.  So you can copy and paste my catch block.</p>
<p>Ok, so to review, we created our solution and then created a project to house our services.  We created one service that is consuming a method from an existing application and are supporting it with a data contract and an operation contract.</p>
<p>The next step will be to host the service so we can work with it, and we&#8217;ll do that in the next article.  In that post we will learn how to set up IIS7 to host a service using the net.tcp protocol which is much faster than http and can feed either a website or a windows form application equally well.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[A Practical Architecture for WCF - Part 1]]></title>
<link>http://computermutt.wordpress.com/2009/08/20/a-practical-architecture-for-wcf-part-1/</link>
<pubDate>Thu, 20 Aug 2009 20:39:22 +0000</pubDate>
<dc:creator>Mike Malter</dc:creator>
<guid>http://computermutt.wordpress.com/2009/08/20/a-practical-architecture-for-wcf-part-1/</guid>
<description><![CDATA[This is the first in a series of articles designed to provide an example of a practical architecture]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>This is the first in a series of articles designed to provide an example of a practical architecture for WCF in its support of a services oriented architecture.</p>
<p>We are going to look at how you could take an existing web site and wrap its functionality in services to be consumed by either a web site or a windows forms application.  We will show you how to configure your network and servers to offer these services across domains and machine boundaries.  We&#8217;ll also take a look at how to structure data contracts to provide robust objects and lists of objects across the wire with exception reporting.  Finally we&#8217;ll look at how to configure support for distributed transactions and some suggestions for structuring projects to make testing and deployment easier.</p>
<p>There are a few references that I recommend using as you are learning WCF and they are posted <a title="Highly Recommended WCF Learning Resources" href="http://computermutt.wordpress.com/2009/05/06/highly-recommended-wcf-learning-resources/" target="_blank">here on the Computer Mutt</a>.  Those resources will address a wider range of WCF concepts much more in-depth than I will here as this article is focused on providing an approach to a particular problem, and not structured to review all options that are available.  Michelle Leroux&#8217;s introduction in the chapter on working with WCF in Visual Studio 2008 which covers SOA and WCF is total gold, and every time I re-read it I get something out of it.</p>
<p>Ok, let&#8217;s take the first step look at what we have and what we want to wind up with.  We are starting out with a current web site that site is a very simple ASP.NET 3.5 public web application in production that provides a list of cheese brands and cheese types that are made without animal rennet.   It has discreet layers consisting of a data layer, business layer and presentation layer in the form of web pages.  The data layer talks to Microsoft SQL Server 2008 and runs on IIS7 on Windows Server 2008.  Everything is 64 bit and everything is on a single box.  Basically it is simple running website and thus a good candidate for a first step.</p>
<p>Here is a network diagram showing the current architecture of the website we are going to transform:</p>
<p><img class="size-full wp-image-225" title="Current Architecture" src="http://computermutt.wordpress.com/files/2009/08/currentarchitecture.png" alt="Current Architecture" width="670" height="639" /></p>
<p>The diagram below is what the architecture will look like after we transform it.  The differences are that major components are separated by machine boundaries.  The database has its own box, services has its own box, and the web site has its own box.  On the services box we also have the original business and data layers along with IIS.  </p>
<p>Once we transform our original website and began offering services, we are simply serving content to presentation layers both inside and outside of your network allowing you to use either browsers or Windows Forms applications.  In the case of a browser, the user points to a URL to get content, in your Windows Forms application, you can configure an endpoint to point to, either way, desktop configuration and support can be much simpler as a result.</p>
<p>Configuring the environment for services behind the firewall is simpler than offering them over the network, and the scope of this series is for services on the inside of the firewall.  In a subsequent article, I&#8217;ll walk you through the steps necessary to offer secure services over the internet.</p>
<p><img class="alignleft size-full wp-image-233" title="NewArchitecture" src="http://computermutt.wordpress.com/files/2009/08/newarchitecture.png" alt="NewArchitecture" width="670" height="624" /></p>
<p>We are going to use Visual Studio 2008 with .NET 3.5 along with WCF Services Templates to code services.  Development is on a Vista machine.  An aside on Vista first.  I&#8217;ve heard how Vista sucked and to avoid it, however when I switched to developing and supporting ASP.NET apps on Windows Server 2008 &#38; IIS7, I found that using Vista simplified development. </p>
<p>First, Vista uses IIS7 (which is the version on Server 2008) and it understands the web.config files generated by Visual Studio 2008.  I can also configure those web.config files once in one place in the file, unlike developing on XP where you have to configure the same thing in several places in the file.  Yes, UAC blows, but you can turn it off and I have had no problems using it.  I&#8217;m not advocating that you switch from XP if you want to develop services to run on Windows Server 2008, I&#8217;m just passing along that I found with Vista I created a less error prone development environment.</p>
<p>One last word on environment.  While you will be able to do everything in this series of articles on one machine, it will work out better for you in the long run if you have an Active Directory environment with at least three dedicated boxes; Web, Services, Database.  If you have limited equipment, consider creating seperate environments using Hyper-V.  Go to <a title="Cloning Virtual Machines using Hyper-V Without the Pain" href="http://computermutt.wordpress.com/category/hyper-v/" target="_blank">my recent post </a>for help on creating and cloning Hyper-V environments. </p>
<p>I really want to emphasize that it is in your interest to invest the sweat in creating seperate environments to run the examples in this series.  The reason is that a lot happens by default when you run everything on a single box and you&#8217;ll never realize it until you begin to move things around, and by then you&#8217;ll have to spend an undetermined amount of time to backtrack to uncover your mistakes.  Also, nobody is really going to be running this stuff on a single machine in a production environment anyway, so you might as well get used to it right off of the bat.  If you understand what the network requires to support WCF you&#8217;ll be more valuable to your company and customers.  </p>
<p>Before finishing this introduction, some thoughts on the Web Client Software Factory (WCSF).  This tool will allow you to code WCF services using a visual designer in Visual Studio.   One of its strengths is that it forces a particular format on project directory structure which can be advantagous since everyone on the team will be forced to structure their work the same way.   I began working in WCF using this tool, and I have to say it was a very confusing time for me as took a lot of effort to understand where the tool left off and WCF began; it was unnecessairly complex.</p>
<p>Furtheremore, once you start a project in the tool and need to make changes, you must go back and make them through the designer.  There are some other very severe side effects to.  One is that the tool will create directory and filenames that will break Visual Studio and this goes double if you are using Team Foundation Server.  Having outlined some of my concerns, you have to that creating such a tool is a huge accomplishment, and although this tool is just in its beginning stages, over time I am certian refinements will be introduced smoothing out some of its early difficulties.</p>
<p>In my mind it is best to start out simply and do everything manually so you get a clear understanding of what you need to do to support WCF services.</p>
<p>Next up &#8211; <a title="A Practical Architecture for WCF - Part 2" href="http://computermutt.wordpress.com/2009/08/24/a-practical-architecture-for-wcf-part-2/">A Practical Architecture for WCF &#8211; Part 2</a> which will demonstrate the creation of services.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[How can I set IIS7 App Pools to &ldquo;Classic&rdquo; mode?]]></title>
<link>http://wellroundeddevelopment.wordpress.com/2009/08/13/how-can-i-set-iis7-app-pools-to-classic-mode/</link>
<pubDate>Thu, 13 Aug 2009 01:03:00 +0000</pubDate>
<dc:creator>sadpenguininsnow</dc:creator>
<guid>http://wellroundeddevelopment.wordpress.com/2009/08/13/how-can-i-set-iis7-app-pools-to-classic-mode/</guid>
<description><![CDATA[when a new application Pool is created on IIS7 there is a new setting named “Managed Pipeline” which]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>when a new application Pool is created on IIS7 there is a new setting named “Managed Pipeline” which controls some low-level memory and .NET access to all application running in that AppPool. Most legacy application will not react well to the default setting of “Integrated” and instead require “Classic” to be set.</p>
<p>This is very easy to do manually.</p>
<p>What is you need to do this programmatically however? Microsoft supplies a tool that allows you to configure all aspects of IIS7 from the command line if you want to. this command is named “appcmd.exe” and is located in the %WinDir% here:</p>
<blockquote><p>%WinDir%\system32\inetsrv\appcmd.exe</p>
</blockquote>
<p>Here is an example changing Default App Pool to classic mode:</p>
<blockquote><p>%WinDir%\system32\inetsrv\appcmd.exe set apppool “Default App pool” /managedPipelineMode:Classic</p>
</blockquote>
<p>This tool will always exist if IIS7 is installed.</p>
<p>Great…now what? we have a tool that will always be present with IIS7, the basic help for that file, and the basic knowledge of what needs to change. that is enough to write a short InstallScript function that we then pass the name of the Application Pool we want to change.</p>
<p><font color="#00ff00">//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-      <br />// Function: SetAppPoolClassic&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />// Purpose: set the Application Pool passed in to run under Classic mode for IIS7       <br />//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</font>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />export prototype NUMBER SetAppPoolClassic(STRING);     <br />function NUMBER SetAppPoolClassic(szAppPoolName)     <br />&#160;&#160;&#160; NUMBER nResult;     <br />&#160;&#160;&#160; STRING szProgram, szCmdLine;     <br />begin     <br />&#160;&#160;&#160; szProgram = &#34;%winDir%\system32\inetsrv\appcmd.exe&#34;;     <br />&#160;&#160;&#160; LongPathToQuote(szProgram, TRUE);     <br />&#160;&#160;&#160; szCmdLine = &#34; set apppool \&#34;&#34; + szAppPoolName + &#34;\&#34; /managedPipelineMode:Classic&#34;;     <br />&#160;&#160;&#160; if (LaunchAppAndWait(szProgram, szCmdLine, WAIT) &#60; 0) then     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; MessageBox(&#34;Failed to launch &#34; + szProgram, SEVERE);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; nResult = -1;     <br />&#160;&#160;&#160; else     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; nResult = 0;     <br />&#160;&#160;&#160; endif;     <br />&#160;&#160;&#160; return nResult;     <br />end;</p>
<p>InstallShield 2010 actually has the ability to set this built into the GUI…but this works for any version of InstallShield.</p>
<p>More information about AppCMD.exe can be found here: <a title="http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe" href="http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe">http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[IIS 7.0 Web Deployment Tools]]></title>
<link>http://mohammedatef.wordpress.com/2009/07/27/iis-7-0-web-deployment-tools/</link>
<pubDate>Mon, 27 Jul 2009 14:21:50 +0000</pubDate>
<dc:creator>mohammedatef83</dc:creator>
<guid>http://mohammedatef.wordpress.com/2009/07/27/iis-7-0-web-deployment-tools/</guid>
<description><![CDATA[Today i am going to talk about IIS 7.0 new feature in deployment and packaging.First you must know t]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Today i am going to talk about IIS 7.0 new feature in deployment and packaging.First you must know that all the new extension for IIS 7.0 are found in Microsoft Web Platform Installer you can download it from <a href="http://www.microsoft.com/web/downloads/platform.aspx" target="_blank">here</a>, this is a free tool that makes it simple to download, install and keep up-to-date with the latest components of the Microsoft Web Platform, including Internet Information Services (IIS), SQL Server Express, .NET Framework and Visual Web Developer.</p>
<p>so to do our new features of deployment please download and install it.</p>
<p>Now let’s take a look for the new deployment feature found in IIS 7.0</p>
<p><strong>1- Synchronize web application</strong></p>
<p>I think all of you was trying to move his web application from QC or Dev environment to production server and was a lot of time for build the new package and deploy it, but now using IIS 7.0 you do this stuff in few seconds by one line of dos command.</p>
<p>just go to dos command window and write the below line<br />
<em>C:\program Files\IIs\Microsoft web deploy&#62;msdeploy –verb:sync –source:apphostconfig=[webapplicationname] –dest:auto,computername=[destination server name]</em></p>
<p>assume the following<br />
[webapplicationname] is the web application name that you are trying to move it from on server to another.<br />
[destination server name] is the destination server name.</p>
<p>after writing this line of command press Enter Key then you can find the new web application found into your IIs destination server.</p>
<p><strong>2- Package</strong></p>
<p>IIS 7.0 has also nice feature for package you web site in easy and quick way you need to follow this steps only</p>
<p><em>Right click-&#62;Package and Install-&#62;Package Sites and Applications<br />
</em>after that just follow the wizard to finish this stuff.</p>
<p><strong>3- Deploy</strong></p>
<p>After creating the package you need to deploy it to another server…yeah IIS 7.0 also doing this step for you in the below few steps</p>
<p><em>Right click-&#62;Package and Install-&#62;install sites and applications</em></p>
<p>I think you are happy now you can do many tasks in few minute using IIS 7.0 .. Good Luck but for you information IIS 7.0 has more and more new feature try to learn it.</p>
<p><strong>I Hope this Help.</strong></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[IIS7 for Windows Hosting]]></title>
<link>http://hostingaspnet.wordpress.com/2009/07/21/iis7/</link>
<pubDate>Tue, 21 Jul 2009 03:57:41 +0000</pubDate>
<dc:creator>usil12</dc:creator>
<guid>http://hostingaspnet.wordpress.com/2009/07/21/iis7/</guid>
<description><![CDATA[Introduction IIS Internet Information  Services is a set of Internet- based services for servers cre]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Introduction IIS</p>
<p>Internet Information  Services is a set of Internet- based services for servers created by Microsoft for use with Microsoft Windows. A common function of a Web server such as IIS is to accept requests for files  from a Web client and service the request by obtaining the file and transmitting  the contents back to the client. In many cases, files delivered to clients are  stored locally on the IIS server. This is the optimum design for speed and also  ensures that new content is delivered as soon as the files are updated. For  installations with a few Web sites that deliver a small set of easy-to-manage  files, hosting the content locally on the IIS server is the best choice from the  simplicity and performance perspectives.</p>
<p><strong>IIS7</strong></p>
<p>Internet Information Services 7 (IIS7) is Microsoft’s latest version of  their web server. IIS7 can be perform with Windows Vista and include in Windows Server 2008. IIS7 has been designed to be the most secure and flexible web and  application platform from Microsoft. Microsoft has redesigned IIS from the  ground and during this process the IIS team has focused on 5 major areas:</p>
<ul>
<li>Security</li>
<li>Extensibility</li>
<li>Configuration and Deployment</li>
<li>Administration and Diagnostics</li>
<li>Performance</li>
</ul>
<p>IIS7 introduces the system of a &#8220;modular architecture&#8221;. A modular  architecture is one in which the extra functionality in the form of different  modules can be added to the server and could be enabled or disabled depending on  the administrator&#8217;s wish. This is a marked change from the monolithic  architecture implemented in earlier systems.</p>
<p>The modules that shall be shipped with the server include:</p>
<ol>
<li>HTTP Modules</li>
<li>Security Modules</li>
<li>Content Modules</li>
<li>Compression Modules</li>
<li>Caching Modules</li>
<li>Logging and Diagnostics Modules</li>
</ol>
<p><strong>Where you can find Hosting with IIS7 ?</strong></p>
<p>Now, WebHostForASP.NET fully supported for <a title="IIS7 Hosting" href="http://webhostforasp.net/iis7-hosting.aspx" target="_self">IIS7 Hosting</a>. WebHostForASP.NET is one of the leading US Hosting Provider which specialized with <a title="ASP.NET hosting" href="http://webhostforasp.net/asp.net-web-hosting/" target="_self">ASP.NET Hosting</a> and Windows Hosting. WebHostForASP.NET has support for many customer around the world and give them high stat for their website.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[IIS7 ]]></title>
<link>http://overpro.wordpress.com/2009/07/18/iis7/</link>
<pubDate>Sat, 18 Jul 2009 15:20:25 +0000</pubDate>
<dc:creator>overpro</dc:creator>
<guid>http://overpro.wordpress.com/2009/07/18/iis7/</guid>
<description><![CDATA[IS7 的配置 IIS7可通过.config文本文件来配置 C:\inetpub\temp\appPools 这个文件夹里面“保存”了应用程序池的配置, 或者说是某个站点配置的文本文件形式的缓冲。 在]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><h3><strong>IS7 的配置</strong></h3>
<p><span> </span>IIS7可通过.config文本文件来配置<br />
<span> </span><span> </span>C:\inetpub\temp\appPools<br />
<span> </span>这个文件夹里面“保存”了应用程序池的配置, 或者说是某个站点配置的文本文件形式的缓冲。<br />
<span> </span><span> </span></p>
<p><span> </span>在server 2008 x64 + iis7的环境下遇到过一个问题：<br />
一开始不熟悉IIS7的配置，在iis配置管理器（GUI管理工具）中无法删除一个错误的 isapiFilters dll路径。 由于该配置指定了一个错误的isapi extension 的 DLL文件路径，导致iis总是在准备提供HTTP服务时候加载这个dll而无法正常工作。<br />
这种情况下通过文本编辑器打开appPools里面的.config配 置文件手动修改有效果&#8211;<span> </span>这个问题是通过sysInternal的process monitor工具发现的，在process monitor的文件访问记录中看到了w3wp.exe试图加载那个dll, 但返回结果是path not found, 然后双击这条记录， 能看到执行的命令中包含了 appPool.config这个参数，于是找到那个文件，其中果然列着那个 dll文件的错误路径，修改后IIS即可正常工作，但重启IIS以后就又不行了。<br />
后来发现ISAPI Filters是在Website级别进行设置的，修正了错误的路径以后一切正常了。</p>
<h3><strong>Server 2008 IIS7 的Perl</strong></h3>
<p>经过测试，可以让应用程序池启用32位模式，然后用perlis.dll，这样perl是工作在ISAPI模式下。 x64似乎还不能用ISAPI模式，只能用perl.exe的CGI模式。</p>
<h3><strong>Server 2008 II7 PHP</strong></h3>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Using CakePHP with IIS7]]></title>
<link>http://myleskadusale.wordpress.com/2009/07/13/using-cakephp-with-iis7/</link>
<pubDate>Mon, 13 Jul 2009 06:21:44 +0000</pubDate>
<dc:creator>myleskadusale</dc:creator>
<guid>http://myleskadusale.wordpress.com/2009/07/13/using-cakephp-with-iis7/</guid>
<description><![CDATA[Found a post the shows how to install CakePHP in IIS7 Click Here]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Found a post the shows how to install CakePHP in IIS7 <a href="http://blogs.iis.net/tobintitus/archive/2009/04/03/installing-cakephp-on-iis-7.aspx">Click Here</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Host WCF Services in IIS7 and Vista]]></title>
<link>http://colmac73.wordpress.com/2009/07/01/host-wcf-services-in-iis7-and-vista/</link>
<pubDate>Wed, 01 Jul 2009 10:01:00 +0000</pubDate>
<dc:creator>colmac73</dc:creator>
<guid>http://colmac73.wordpress.com/2009/07/01/host-wcf-services-in-iis7-and-vista/</guid>
<description><![CDATA[Had frustrating time trying to get this to work until it finally clicked that there was no handler f]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Had frustrating time trying to get this to work until it finally clicked that there was no handler for the .svc extension in IIS7.</p>
<p>Eventually found this <a href="http://blogs.mscommunity.net/blogs/borissevo/archive/2007/10/30/hosting-wcf-services-in-iis7-and-windows-vista.aspx" target="_blank">post</a> that lists a number of steps to get it to work&#8230;although i only had to apply Step 2.</p>
<p>Run <b>servicemodelreg</b> with a <b>-i</b> option:</p>
<p>&#160;&#160;&#160;&#160;&#160; C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation&#62;ServiceModelReg -i</p>
<p>This installs all the necessary handlers and features for WCF hosting in IIS7.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[.NET and Coldfusion and IIS7 and Charting and AJAX and…]]></title>
<link>http://aspnetteam.wordpress.com/2009/06/23/net-and-coldfusion-and-iis7-and-charting-and-ajax-and%e2%80%a6/</link>
<pubDate>Tue, 23 Jun 2009 17:30:00 +0000</pubDate>
<dc:creator>Frank Adams</dc:creator>
<guid>http://aspnetteam.wordpress.com/2009/06/23/net-and-coldfusion-and-iis7-and-charting-and-ajax-and%e2%80%a6/</guid>
<description><![CDATA[ARRGH!      I am in the process of creating an application that uses the MS Charting controls along ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><div class="wp-caption alignleft" style="width: 394px"><img class=" " title="ARRGH!" src="http://successbeginstoday.org/wordpress/wp-content/uploads/2008/03/arrgh-computer.jpg" alt="ARRGH!" width="384" height="256" /><p class="wp-caption-text">ARRGH!</p></div>
<p>     I am in the process of creating an application that uses the MS Charting controls along with some AJAX.  I was working on my machine of XP with VS 2008.  I didn’t have IIS installed so I was using built in browser functionality from VS to view site. Everything was going great. Was being the key word.  I had to finally move it over to a real development environment for more reasons than one.  When I finally moved the application it broke. It just wouldn’t work.  I got a 500 error.  Then after a few refreshes I found that I had this error: The WebResource.axd handler must be registered in the configurtion to process this request.  What!? What does that mean?  I searched for a few days to find a solution. I came up with a few from restarting the web service to reinstalling the .NET framework (none of which worked by the way).  After 4 days I finally came across the solution, Coldfusion does not play well with AJAX and .NET. For some reason, after looking at the compiled error logs, I saw that my appication was calling a .DLL in the Coldfusion directory.  Why on earth would my Microsoft .NET 3.5 SP1 application even be concerned with anything Coldfusion?  It seems that it is a mapping issue within IIS 7.  Yup, IIS 7. I had to remove (not sure if it was the right thing to do) but I removed all mappings to anything Coldfusion (.cfm, cfml, jsp, etc.).  It it was mapped to anything in the Coldfusion directory, I got rid of it.  Guess what?  It worked.  Application works like a champ now!  I am putting this up here so to be another resource to call upon.  There wasn’t anything I found that said to do what I did.  The closest I came was to have .NET and Coldfusion install on different servers.  Likely scenerio.  Yea right… Hope this helped someone.  Have fun coding and as always, if there are any questions or suggestions, they are welcome.  Thank you.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[How to improve your YSlow score under IIS7]]></title>
<link>http://jonathangeorge.co.uk/2009/09/09/how-to-improve-your-yslow-score-under-iis7/</link>
<pubDate>Wed, 09 Sep 2009 00:00:13 +0000</pubDate>
<dc:creator>Jonathan</dc:creator>
<guid>http://jonathangeorge.co.uk/2009/09/09/how-to-improve-your-yslow-score-under-iis7/</guid>
<description><![CDATA[Note: This was originally posted on my old blog at the EMC Consulting Blogs site. On my last two pro]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><strong>Note: This was originally posted on <a href="http://consultingblogs.emc.com/jonathangeorge/archive/2009/09/09/how-to-improve-your-yslow-score-under-iis7.aspx" target="_blank">my old blog</a> at the <a href="http://consultingblogs.emc.com/" target="_blank">EMC Consulting Blogs site</a>.</strong></p>
<p>On my last two projects, I’ve been involved in various bits of performance tweaking and testing. One of the common tools for checking that your web pages are optimised for delivery to the user is YSlow, which rates your pages against the <a href="http://developer.yahoo.com/performance/rules.html" target="_blank">Yahoo! best practices guide</a>.</p>
<p>Since I’ve now done this twice, I thought it would be useful to document what I know about the subject. The examples I’ve given are from my current project, which is built using ASP.NET MVC, the <a href="http://sparkviewengine.com/" target="_blank">Spark View Engine</a> and hosted on IIS7.</p>
<h3>Make Fewer Http Requests</h3>
<p>There are two sides to this. Firstly and most obviously, the lighter your pages the faster the user can download them. This is something that has to be addressed at an early stage in the design process – you need to ensure you balance up the need for a compelling and rich user experience against the requirements for fast download and page render times. Having well defined non-functional&#160; requirements up front, and ensuring that page designs are technically reviewed with those SLAs in mind is an important part of this. As I have learned from painful experience, having a conversation about slow page download times after you’ve implemented the fantastic designs that the client loved is not nice.</p>
<p>The second part of this is that all but the sparsest of pages can still be optimised by reducing the number of individual files downloaded. You can do this by combining your CSS, Javascript and image files into single files. CSS and JS combining and <a href="http://en.wikipedia.org/wiki/Minification_%28programming%29" target="_blank">minification</a> is pretty straightforward these days, especially with things like the <a href="http://yuicompressor.codeplex.com/" target="_blank">Yahoo! UI Library: YUI Compressor for .NET</a>. On my current project, we use the MSBuild task from that library to combine, minify and obfuscate JS and CSS as part of our release builds. To control which files are referenced in our views, we add the list of files to our base ViewModel class (from which all the other page ViewModels inherit) using conditional compilation statements.</p>
<div style="display:block;float:none;margin-left:auto;margin-right:auto;padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:16e69d12-73a0-4ae6-866c-5b0f3412ca90" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#ddd;max-height:300px;overflow:scroll;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li> <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> ConfigureJavaScriptIncludes(<span style="color:#2b91af;">PageViewModel</span> viewModel)</li>
<li style="background:#f3f3f3;"> {</li>
<li> <span style="color:#0000ff;">#if</span> DEBUG</li>
<li style="background:#f3f3f3;">     viewModel.JavaScriptFiles.Add(<span style="color:#a31515;">&#8220;Libraries/jquery-1.3.2.min.js&#8221;</span>);</li>
<li>     viewModel.JavaScriptFiles.Add(<span style="color:#a31515;">&#8220;Libraries/jquery.query.js&#8221;</span>);</li>
<li style="background:#f3f3f3;">     viewModel.JavaScriptFiles.Add(<span style="color:#a31515;">&#8220;Libraries/jquery.validate.js&#8221;</span>);</li>
<li>     viewModel.JavaScriptFiles.Add(<span style="color:#a31515;">&#8220;Libraries/xVal.jquery.validate.js&#8221;</span>);</li>
<li style="background:#f3f3f3;">     viewModel.JavaScriptFiles.Add(<span style="color:#a31515;">&#8220;resources.js&#8221;</span>);</li>
<li>     viewModel.JavaScriptFiles.Add(<span style="color:#a31515;">&#8220;infoFlyout.js&#8221;</span>);</li>
<li style="background:#f3f3f3;">     viewModel.JavaScriptFiles.Add(<span style="color:#a31515;">&#8220;bespoke.js&#8221;</span>);</li>
<li> <span style="color:#0000ff;">#else</li>
<li style="background:#f3f3f3;"> </span><span style="color:#808080;">    viewModel.JavaScriptFiles.Add(&#8220;js-min.js&#8221;);</li>
<li> </span><span style="color:#0000ff;">#endif</span></li>
<li style="background:#f3f3f3;"> }</li>
<li> </li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> ConfigureStyleSheetIncludes(<span style="color:#2b91af;">PageViewModel</span> viewModel)</li>
<li> {</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">#if</span> DEBUG</li>
<li>     viewModel.CssFile = <span style="color:#a31515;">&#8220;styles.css&#8221;</span>;</li>
<li style="background:#f3f3f3;"> <span style="color:#0000ff;">#else</li>
<li> </span><span style="color:#808080;">    viewModel.CssFile = &#8220;css-min.css&#8221;;</li>
<li style="background:#f3f3f3;"> </span><span style="color:#0000ff;">#endif</span></li>
<li> }</li>
<li style="background:#f3f3f3;"> </li>
</ol>
</div>
</div>
</div>
<p>Images are more tricky, and we’ve made the decision to not bother using <a href="http://css-tricks.com/css-sprites/" target="_blank">CSS Sprites</a> since most of the ways to do it are manual. If this is important to you, see the end of this post for a tool that can do it on the fly.</p>
<h3>Use a Content Delivery Network</h3>
<p>This isn’t something you can’t really address through configuration. In case you’re not aware, the idea is to farm off the hosting of static files onto a network of geographically distributed servers, and ensure that each user receives that content from the closest server to them. There are a number of CDN providers around – Akamai, Amazon Cloud Front and Highwinds, to name but a few.</p>
<p>The biggest problem I’ve encountered with the use of CDNs is for sites which have secure areas. If you want to avoid annoying browser popups telling you that your secure page contains insecure content, you need to ensure that your CDN has both a http and https URLs, and that you have a good way of switching between them as needed. This is a real pain for things like background images in CSS and I haven’t found a good solution for it yet.</p>
<p>On the plus side I was pleased to see that Spark provides support for CDNs in the form of it’s &#60;resources&#62; section, which allows you to define a path to match against an a full URL to substitute – so for example, you could tell it to map all files referenced in the path “~/content/css/” to “http://yourcdnprovider.com/youraccount/allstyles/css/”. Pretty cool – if <a href="http://whereslou.com/" target="_blank">Louis</a> could extend that to address the secure/insecure path issue, it would be perfect.</p>
<h3>Add an Expires or Cache-Control Header</h3>
<p>The best practice recommendation is to set far future expiry headers on all static content (JS/CSS/images/etc). This means that once the files are pushed to production you can never change them, because users may have already downloaded and cached an old version. Instead, you change the content by creating new files and referencing those instead (<a href="http://developer.yahoo.com/performance/rules.html#expires" target="_blank">read more here</a>.) This is fine for most of our resources, but sometimes you will have imagery which has to follow a set naming convention – this is the case for my current project, where the product imagery is named in a specific way. In this scenario, you just have to make sure that the different types of images are located in separate paths so you can configure them independently, and then choose an appropriate expiration policy based on how often you think the files will change.</p>
<p>To set the headers, all you need is a web.config in the relevant folder.&#160; You can either create this manually, or using the IIS Manager, which will create the file for you. To do it using IIS Manager, select the folder you need to set the headers for, choose the “HTTP Response Headers” option and then click the “Set Common Headers” option in the right hand menu. I personally favour including the web.config in my project and in source control as then it gets deployed with the rest of the project (a great improvement over IIS6).</p>
<p>Here’s the one we use for the Content folder.</p>
<div style="display:block;float:none;margin-left:auto;margin-right:auto;padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ae1f72a4-baff-49f9-b8ae-96ab006d702c" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#ddd;max-height:300px;overflow:scroll;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li> <span style="color:#0000ff;">&#60;?</span><span style="color:#a31515;">xml</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">version</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">1.0</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">encoding</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">UTF-8</span>&#8220;<span style="color:#0000ff;">?&#62;</li>
<li style="background:#f3f3f3;"> &#60;</span><span style="color:#a31515;">configuration</span><span style="color:#0000ff;">&#62;</li>
<li>   &#60;</span><span style="color:#a31515;">system.webServer</span><span style="color:#0000ff;">&#62;</li>
<li style="background:#f3f3f3;">     &#60;</span><span style="color:#a31515;">staticContent</span><span style="color:#0000ff;">&#62;</li>
<li>       &#60;</span><span style="color:#a31515;">clientCache</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">cacheControlMode</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">UseExpires</span>&#8220;<span style="color:#0000ff;"> </li>
<li style="background:#f3f3f3;">                    </span><span style="color:#ff0000;">httpExpires</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">Sat, 31 Dec 2050 00:00:00 GMT</span>&#8220;<span style="color:#0000ff;"> /&#62;</li>
<li>     &#60;/</span><span style="color:#a31515;">staticContent</span><span style="color:#0000ff;">&#62;</li>
<li style="background:#f3f3f3;">   &#60;/</span><span style="color:#a31515;">system.webServer</span><span style="color:#0000ff;">&#62;</li>
<li> &#60;/</span><span style="color:#a31515;">configuration</span><span style="color:#0000ff;">&#62;</li>
<li style="background:#f3f3f3;"> </span></li>
</ol>
</div>
</div>
</div>
<p>This has the effect of setting the HTTP Expires header to the date specified.</p>
<p>And here’s what we use for the product images folder.</p>
<div style="display:block;float:none;margin-left:auto;margin-right:auto;padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e4d96b59-c420-4fd4-90a3-f07a7cea6e7a" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#ddd;max-height:300px;overflow:scroll;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li> <span style="color:#0000ff;">&#60;?</span><span style="color:#a31515;">xml</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">version</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">1.0</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">encoding</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">UTF-8</span>&#8220;<span style="color:#0000ff;">?&#62;</li>
<li style="background:#f3f3f3;"> &#60;</span><span style="color:#a31515;">configuration</span><span style="color:#0000ff;">&#62;</li>
<li>   &#60;</span><span style="color:#a31515;">system.webServer</span><span style="color:#0000ff;">&#62;</li>
<li style="background:#f3f3f3;">     &#60;</span><span style="color:#a31515;">staticContent</span><span style="color:#0000ff;">&#62;</li>
<li>       &#60;</span><span style="color:#a31515;">clientCache</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">cacheControlMode</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">UseMaxAge</span>&#8220;<span style="color:#0000ff;"> </li>
<li style="background:#f3f3f3;">                    </span><span style="color:#ff0000;">cacheControlMaxAge</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">7.00:00:00</span>&#8220;<span style="color:#0000ff;"> /&#62;</li>
<li>     &#60;/</span><span style="color:#a31515;">staticContent</span><span style="color:#0000ff;">&#62;</li>
<li style="background:#f3f3f3;">   &#60;/</span><span style="color:#a31515;">system.webServer</span><span style="color:#0000ff;">&#62;</li>
<li> &#60;/</span><span style="color:#a31515;">configuration</span><span style="color:#0000ff;">&#62;</li>
<li style="background:#f3f3f3;"> </span></li>
</ol>
</div>
</div>
</div>
<p>This writes max-age=604800 (7 days worth of seconds) into the Cache-Control header in the response. The browser will use this in conjunction with the Date header to determine whether the cached file is still valid.</p>
<p>Our HTML pages all have max-age=0 in the cache-control header, and have the expires header set to the same as the Date and Last-Modified headers, as we don’t want these cached – it’s an ecommerce website and we have user-specific infomation (e.g. basket summary, recently viewed items) on each page.</p>
<h3>Compress components with Gzip</h3>
<p>IIS7 does this for you out of the box but it’s not always 100% clear how to configure it, so, here’s the details.</p>
<p>Static compression is for files that are identical every time they are requested, e.g. Javascript and CSS. Dynamic compression is for files that differ per request, like the HTML pages generated by our app. The content types that actually fall under each heading are controlled in the IIS7 metabase, which resides in the file C:\Windows\System32\inetsrv\config\applicationHost.config. In that file, assuming you have both static and dynamic compression features enabled, you’ll be able to find the following section:</p>
<div style="display:block;float:none;margin-left:auto;margin-right:auto;padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:b775a157-c16b-4d9c-bf58-5298526f752a" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#ddd;max-height:300px;overflow:scroll;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 35px;">
<li> <span style="color:#0000ff;">&#60;</span><span style="color:#a31515;">httpCompression</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">directory</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">%SystemDrive%&#92;inetpub&#92;temp&#92;IIS Temporary Compressed Files</span>&#8220;<span style="color:#0000ff;">&#62;</li>
<li style="background:#f3f3f3;">   &#60;</span><span style="color:#a31515;">scheme</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">name</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">gzip</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">dll</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">%Windir%&#92;system32&#92;inetsrv&#92;gzip.dll</span>&#8220;<span style="color:#0000ff;"> /&#62;</li>
<li>   &#60;</span><span style="color:#a31515;">dynamicTypes</span><span style="color:#0000ff;">&#62;</li>
<li style="background:#f3f3f3;">     &#60;</span><span style="color:#a31515;">add</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">mimeType</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">text/*</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">enabled</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">true</span>&#8220;<span style="color:#0000ff;"> /&#62;</li>
<li>     &#60;</span><span style="color:#a31515;">add</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">mimeType</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">message/*</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">enabled</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">true</span>&#8220;<span style="color:#0000ff;"> /&#62;</li>
<li style="background:#f3f3f3;">     &#60;</span><span style="color:#a31515;">add</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">mimeType</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">application/x-javascript</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">enabled</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">true</span>&#8220;<span style="color:#0000ff;"> /&#62;</li>
<li>     &#60;</span><span style="color:#a31515;">add</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">mimeType</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">*/*</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">enabled</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">false</span>&#8220;<span style="color:#0000ff;"> /&#62;</li>
<li style="background:#f3f3f3;">   &#60;/</span><span style="color:#a31515;">dynamicTypes</span><span style="color:#0000ff;">&#62;</li>
<li>   &#60;</span><span style="color:#a31515;">staticTypes</span><span style="color:#0000ff;">&#62;</li>
<li style="background:#f3f3f3;">     &#60;</span><span style="color:#a31515;">add</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">mimeType</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">text/*</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">enabled</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">true</span>&#8220;<span style="color:#0000ff;"> /&#62;</li>
<li>     &#60;</span><span style="color:#a31515;">add</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">mimeType</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">message/*</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">enabled</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">true</span>&#8220;<span style="color:#0000ff;"> /&#62;</li>
<li style="background:#f3f3f3;">     &#60;</span><span style="color:#a31515;">add</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">mimeType</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">application/javascript</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">enabled</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">true</span>&#8220;<span style="color:#0000ff;"> /&#62;</li>
<li>     &#60;</span><span style="color:#a31515;">add</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">mimeType</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">*/*</span>&#8220;<span style="color:#0000ff;"> </span><span style="color:#ff0000;">enabled</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">false</span>&#8220;<span style="color:#0000ff;"> /&#62;</li>
<li style="background:#f3f3f3;">   &#60;/</span><span style="color:#a31515;">staticTypes</span><span style="color:#0000ff;">&#62;</li>
<li> &#60;/</span><span style="color:#a31515;">httpCompression</span><span style="color:#0000ff;">&#62;</span></li>
</ol>
</div>
</div>
</div>
<p>As you can see, configuration is done by response MIME type, making it pretty straightforward to set up…</p>
<table border="0" cellspacing="0" cellpadding="2" width="400">
<tbody>
<tr>
<td valign="top" width="200"><strong>Item</strong></td>
<td valign="top" width="200"><strong>MIME type</strong></td>
</tr>
<tr>
<td valign="top" width="200">Views (i.e. the HTML pages)</td>
<td valign="top" width="200">text/html</td>
</tr>
<tr>
<td valign="top" width="200">CSS</td>
<td valign="top" width="200">text/css</td>
</tr>
<tr>
<td valign="top" width="200">JS</td>
<td valign="top" width="200">application/x-javascript</td>
</tr>
<tr>
<td valign="top" width="200">Images</td>
<td valign="top" width="200">image/gif, image/jpeg, image/png</td>
</tr>
</tbody>
</table>
<p>One gotcha there is that IIS7 is configured out of the box to return a content type of application/x-javascript for .JS files, which results in them coming under the configuration for dynamic compression.This is not great – dynamic compression is intended for frequently changing content so dynamically compressed files are not cached for future requests. Our JS files don’t change outside of deployments, so we really need them to be in the static compression category.</p>
<p>There’s a fair bit of discussion online as to what the correct MIME type for Javascript should be, with the three choices being:</p>
<ul>
<li>text/javascript </li>
<li>application/x-javascript </li>
<li>application/javascript </li>
</ul>
<p>So you have two choices – you can change your config, either in web.config or applicationHost.config to map the .js extension to text/javascript or application/javascript, which are both already registered for static compression, or you can move application/x-javascript into the static configuration section in your web.config or applicationHost.config. I went with the latter option and modified applicationHost.config. I look forward to a comment from anyone who can explain whether that was the correct thing to do or not.</p>
<p>Finally, in the &#60;system.webserver&#62; element of your app’s main web.config, add this:</p>
<div style="display:block;float:none;margin-left:auto;margin-right:auto;padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c85c5401-fce1-4b5a-9534-c1d535a46c33" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#ddd;max-height:300px;overflow:scroll;padding:0;">
<ol style="background:#ffffff;white-space:wrap;margin:0 0 0 25px;">
<li> <span style="color:#0000ff;">&#60;</span><span style="color:#a31515;">urlCompression</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">doStaticCompression</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">true</span>&#8220;<span style="color:#0000ff;"> </li>
<li style="background:#f3f3f3;">                 </span><span style="color:#ff0000;">doDynamicCompression</span><span style="color:#0000ff;">=</span>&#8220;<span style="color:#0000ff;">true</span>&#8220;<span style="color:#0000ff;"> /&#62;</li>
<li> </span></li>
</ol>
</div>
</div>
</div>
<p>Once you’ve got this configured, you’ll probably open up Firebug or Fiddler, hit your app, and wonder why your static files don’t have the Content-Encoding: gzip header. The reason is that IIS7 is being clever. If you return to applicationHost.config, one thing you <strong>won’t </strong>see is this:</p>
<div style="padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:40f60212-4e58-4210-8c8e-138acf719588" class="wlWriterSmartContent">
<div style="font-family:&#39;">
<div style="background:#ddd;max-height:300px;overflow:scroll;padding:0;">
<ol style="background:#ffffff;margin:0 0 0 25px;">
<li><span style="color:#0000ff;">&#60;</span><span style="color:#a31515;">serverRuntime</span><span style="color:#0000ff;"> </span><span style="color:#ff0000;">alternateHostName</span><span style="color:#0000ff;">=</span>&#34;&#34; </li>
<li style="background:#f3f3f3;"><span style="color:#0000ff;"></span><span style="color:#ff0000;">appConcurrentRequestLimit</span><span style="color:#0000ff;">=</span>&#34;<span style="color:#0000ff;">5000</span>&#34; </li>
<li><span style="color:#0000ff;"></span><span style="color:#ff0000;">enabled</span><span style="color:#0000ff;">=</span>&#34;<span style="color:#0000ff;">true</span>&#34; </li>
<li style="background:#f3f3f3;"><span style="color:#0000ff;"></span><span style="color:#ff0000;">enableNagling</span><span style="color:#0000ff;">=</span>&#34;<span style="color:#0000ff;">false</span>&#34; </li>
<li><span style="color:#0000ff;"></span><span style="color:#ff0000;">frequentHitThreshold</span><span style="color:#0000ff;">=</span>&#34;<span style="color:#0000ff;">2</span>&#34; </li>
<li style="background:#f3f3f3;"><span style="color:#0000ff;"></span><span style="color:#ff0000;">frequentHitTimePeriod</span><span style="color:#0000ff;">=</span>&#34;<span style="color:#0000ff;">00:00:10</span>&#34; </li>
<li><span style="color:#0000ff;"></span><span style="color:#ff0000;">maxRequestEntityAllowed</span><span style="color:#0000ff;">=</span>&#34;<span style="color:#0000ff;">4294967295</span>&#34; </li>
<li style="background:#f3f3f3;"><span style="color:#0000ff;"></span><span style="color:#ff0000;">uploadReadAheadSize</span><span style="color:#0000ff;">=</span>&#34;<span style="color:#0000ff;">49152</span>&#34;<span style="color:#0000ff;">&#62; </span></li>
</ol></div>
</p></div>
</p></div>
<p>You’ll just have an empty &#60;serverRuntime /&#62; tag. The values I’ve shown above are the defaults, and the interesting ones are “frequentHitThreshold” and “frequentHitTimePeriod”. Essentially, a file is only a candidate for static compression if it’s a frequently hit file, and those two attributes control the definition of “frequently hit”. So first time round, you won’t see the Content-Encoding: gzip header, but if you’re quick with the refresh button, it should appear. If you spend some time Googling, you’ll find some discussion around setting frequentHitThreshold to 1 – some say it’s a bad idea, some say do it.&#160; Personally, I decided to trust the people who built IIS7 since in all likelihood they have larger brains than me, and move on.</p>
<p>There are a couple of other interesting configuration values in this area – the <a href="http://msdn.microsoft.com/en-us/library/ms690689.aspx" target="_blank">MSDN page covers them in detail</a>.</p>
<h3>Minify Javascript and CSS</h3>
<p>The MSBuild task I mentioned under “Make fewer HTTP requests” minifies the CSS and JS as well as combining the files.</p>
<h3>Configure Entity tags (etags)</h3>
<p>ETags are a bit of a pain, with a lot of confusion and discussion around them. If anyone has the full picture, I’d love to hear it but my current understanding is that when running IIS, the generated etags vary by server, and will also change if the app restarts. Since this effectively renders them useless, we’re removing them. Howard has already blogged <a href="http://blogs.conchango.com/howardvanrooijen/archive/2009/08/25/cloaking-your-asp-net-mvc-web-application-on-iis-7.aspx" target="_blank">this technique for removing unwanted response headers in IIS7</a>. Some people have had luck with <a href="http://serverfault.com/questions/55919/yslow-says-etags-are-misconfigured-how-to-configure-etags-properly-on-iis7" target="_blank">adding a new, blank response header called ETag</a> in their web.config file, but that didn’t work for me.</p>
<h3>Split Components Across Domains</h3>
<p>The HTTP1.1 protocol states that browsers should not make more than two simultaneous connections to the same domain. Whilst the most recent browser versions (IE8, Chrome and Firefox 3+) ignore this, older browsers will normally still be tied to that figure. By creating separate subdomains for your images, JS and CSS you can get these browsers to download more of your content in parallel. It’s worth noting that using a CDN also helps here. Doing this will also help with the “Use Cookie Free Domains For Components” rule, since any domain cookies you use won’t be sent for requests to the subdomains/CDN. However, you will probably fall foul of the issue I mentioned earlier around mixing secure and insecure content on a single page.</p>
<p>A great tool for visualising how your browser is downloading content is <a href="http://www.microsoft.com/Downloads/details.aspx?FamilyID=119f3477-dced-41e3-a0e7-d8b5cae893a3&#38;displaylang=en" target="_blank">Microsoft Visual Roundtrip Analyzer</a>. Fire it up and request a page, and you will be bombarded with all sorts of information (too much to cover here) about how well the site performs for that request.</p>
<h3>Optimise Images</h3>
<p>Sounds obvious, doesn’t it? There are some good tools out there to help with this, such as <a href="http://developer.yahoo.com/yslow/smushit/" target="_blank">Smush.it</a>, now part of <a href="https://addons.mozilla.org/en-US/firefox/addon/5369" target="_blank">YSlow</a>. If you have an image heavy website, you can make a massive difference to overall page weight by doing this.</p>
<h3>Make favicon.ico Small and Cacheable</h3>
<p>If you don’t have a favicon.ico, you’re missing a trick – not least because the browser is going to ask for it anyway, so you’re better returning&#160; one than returning a 404 response. The recommendation is that it’s kept under 1Kb and that it has a fairly long expiration period.</p>
<h2>WAX – Best practice by default</h2>
<p>On my last project, I used the <a href="http://www.aptimize.com/" target="_blank">Aptimize Website Accelerator</a> to handle the majority of the things I’ve mentioned above (my current project has a tight budget, so it’s not part of the solution for v1). It’s a fantastic tool and I’d strongly recommend anyone wishing to speed their site up gives it a try. I was interested to learn recently that Microsoft have started running it on <a href="http://sharepoint.microsoft.com/" target="_blank">sharepoint.microsoft.com</a>, and are seeing a 40-60% reduction in page load times. It handles combination and minification of CSS, Javascript and images, as well as a number of other cool tricks such as inlining images into CSS files where the requesting browser supports it, setting expiration dates appropriately, and so on.</p>
<p><strong>Update: </strong>Microsoft’s SharePoint team have <a href="http://blogs.msdn.com/sharepoint/archive/2009/09/28/how-we-did-it-speeding-up-sharepoint-microsoft-com.aspx" target="_blank">blogged about using WAX on sharepoint.microsoft.com</a>, with the detail being provided by <a href="http://www.aptimize.com/contact-us" target="_blank">Ed Robinson</a>, the CEO of <a href="http://www.aptimize.com/" target="_blank">Aptimize</a>.</p>
<p><a href="http://twitter.com/jon_george1" target="_blank">@jon_george1</a></p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
