<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Tips and tricks: ASP.NET, IIS and .NET development...</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/amb/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/amb/feed.xml</link>
    <description>The notes I take while I solve puzzles...</description>
    <lastBuildDate>Thu, 14 Sep 2017 17:08:06 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>.NET Core &amp; ASP.NET Core 1.0 is being released at Red Hat DevNation.</title>
      <link>https://docs.microsoft.com/archive/blogs/amb/dotnet-core-is-now-rtm</link>
      <pubDate>Mon, 27 Jun 2016 16:15:09 GMT</pubDate>
      <dc:creator><![CDATA[Ahmet Mithat Bostanci]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/amb/?p=1135</guid>
      <description><![CDATA[Today is another milestone on developers' world: .NET Core &amp; ASP.NET Core 1.0 is being released...]]></description>
      <content:encoded><![CDATA[Today is another milestone on developers' world: .NET Core &amp; ASP.NET Core 1.0 is being released at Red Hat DevNation.

If you want to eyewitness that moment you can watch it <a href="https://channel9.msdn.com/Events/Linux/DevNation-2016" target="_blank">here</a>.

If you want to get started with .NET Core &amp; ASP.NET Core 1.0 (if you haven't done yet), you can start with the following resources:

.NET Home Page
<a href="https://dot.net/" target="_blank">https://dot.net/</a>

.NET Documentation
<a href="https://docs.microsoft.com/en-us/dotnet/" target="_blank">https://docs.microsoft.com/en-us/dotnet/</a>

.NET Community
<a href="https://www.microsoft.com/net/community" target="_blank">https://www.microsoft.com/net/community</a>

.NET Blog
<a href="https://blogs.msdn.microsoft.com/dotnet/" target="_blank">https://blogs.msdn.microsoft.com/dotnet/</a>

Channel 9 .NET Channel
<a href="https://channel9.msdn.com/Blogs/dotnet" target="_blank">https://channel9.msdn.com/Blogs/dotnet</a>

.NET Team Twitter Account
<a href="https://twitter.com/DotNet" target="_blank">https://twitter.com/DotNet</a>

.NET Facebook Account
<a href="https://www.facebook.com/Dotnet" target="_blank">https://www.facebook.com/Dotnet</a>

<strong>--</strong>
<strong>AMB</strong>]]></content:encoded>
    </item>
    <item>
      <title>Enlightening a mystery with Failed Request Tracing: does IIS not respect the minFileSizeForComp setting for static compression?</title>
      <link>https://docs.microsoft.com/archive/blogs/amb/iis-respects-minfilesizeforcomp-for-static-compression</link>
      <pubDate>Mon, 23 May 2016 16:47:47 GMT</pubDate>
      <dc:creator><![CDATA[Ahmet Mithat Bostanci]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/amb/?p=1045</guid>
      <description><![CDATA[I have been working with one of my customers to fix some static compression issues on IIS 8.5....]]></description>
      <content:encoded><![CDATA[I have been working with one of my customers to fix some static compression issues on IIS 8.5. During our work I have been asked that if IIS is not respecting the <strong>minFileSizeForComp</strong> settings and if it is compressing the static files that are smaller than the limit configured in the IIS settings.

Before proceeding with the situation and the solution, I would like to explain what that <strong>minFileSizeForComp</strong> setting is used for first:
<blockquote><strong><em>minFileSizeForComp</em></strong>

<em>Specifies the minimum number of <del>kilobytes</del> bytes a file must contain in order to use on-demand compression.</em>

Ref.: <a href="https://www.iis.net/configreference/system.webserver/httpcompression">https://www.iis.net/configreference/system.webserver/httpcompression</a></blockquote>
As explained, if the file size is smaller than the limit configured, then the static file compression will not happen. Note that the default limit is 2700 bytes for IIS 7.5 and the never versions. This means that, a static file (for example a CSS file) will not be compressed if it is smaller than 2700 bytes with the default configuration.

Another note is that this setting will be ignored for the dynamic compression as a by-design behavior.

This configuration is quite useful because compressing the small files may produce larger files so it may cause more bandwidth usage. For example, if you compress a CSS file which is 7 bytes, then you may have a compressed one which is 130 bytes as a result, which is larger than the uncompressed version of the same file. Obviously this will waste the CPU time on the server and will consume more bandwidth.

<strong>PROBLEM</strong>

As I explained in the beginning of this article, my customer asked if this setting is ignored for static files and if the small static files are compressed as an unexpected behavior.

When I searched the internet for the <em>minFileSizeForComp</em> setting, I have found that several discussions have been made around the same topic and the same behavior is reported with no solution or workaround. For example the following forum thread shows the same discussion:
<blockquote>IIS7 Compression not honoring minfilesizeforcomp setting
<a href="https://forums.iis.net/t/1192378.aspx?IIS7+Compression+not+honoring+minfilesizeforcomp+setting">https://forums.iis.net/t/1192378.aspx?IIS7+Compression+not+honoring+minfilesizeforcomp+setting</a></blockquote>
<strong>REPRO</strong>

To understand if IIS really ignores this setting I decided to set up a repro with the following configuration on my test machine:
<ul>
	<li>I set up a web site on my IIS 8.5 machine.</li>
	<li>I created the web site with two CSS files referenced:
<ul>
	<li>/Content/Site.css: a css file which is 7 bytes</li>
	<li>/Content/Bootstrap.css: a css which is 117 KB (120.502 bytes)</li>
</ul>
</li>
	<li>I enabled both Dynamic Compression and Static Compression for my site since I would like to have both dynamic and static files to be compressed:</li>
</ul>
<a href="https://msdnshared.blob.core.windows.net/media/2016/05/compressions_enabled.png"><img class="alignnone wp-image-1065 size-full" src="https://msdnshared.blob.core.windows.net/media/2016/05/compressions_enabled.png" alt="compressions_enabled" width="463" height="171" /></a>

Below is the compression settings for my web site:

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/compressions_configuration.png"><img class="alignnone wp-image-1055 size-full" src="https://msdnshared.blob.core.windows.net/media/2016/05/compressions_configuration.png" alt="compressions_configuration" width="605" height="388" /></a>

Please note the followings:
<ul>
	<li>minFileSizeForComp is 2700 bytes, which is the default value.</li>
	<li>I changed the <em>staticCompressionIgnoreHitFrequency</em> to true so static compression will happen for every requests (please see <a href="https://www.iis.net/configreference/system.webserver/httpcompression">https://www.iis.net/configreference/system.webserver/httpcompression</a> for the details).</li>
</ul>
When I request my site with this configuration I end up with both CSS files are compressed. Please see the Fiddler log below:

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/Fiddler_AllCompressed.png"><img class="alignnone size-full wp-image-1075" src="https://msdnshared.blob.core.windows.net/media/2016/05/Fiddler_AllCompressed.png" alt="Fiddler_AllCompressed" width="561" height="75" /></a>

As seen in the screenshot above, the 7 bytes /Content/Site.css file is served as 130 bytes after compressed with gzip, although I have minFileSizeForComp is set 2700 bytes. Expectation was to serve it uncompressed.

<strong>TROUBLESHOOTING THIS BEHAVIOR</strong>

IIS comes with a great built-in troubleshooting tool called Failed Request Tracing (a.k.a. FREB). FREB can provide a lot of useful information about what happens in the IIS pipeline, either within the Integrated or Classic pipeline.

I set up a FREB rule in my web site for /Content/* path for troubleshooting:

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/Freb_1.png"><img class="alignnone size-full wp-image-1085" src="https://msdnshared.blob.core.windows.net/media/2016/05/Freb_1.png" alt="Freb_1" width="376" height="382" /></a>

Since I am interested in only successful responses from IIS, I set up the rule for HTTP 200 status code. This makes sure to generate FREB logs for every requests made for a file under /Content/ path for HTTP 200 response:

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/Freb_2.png"><img class="alignnone size-full wp-image-1095" src="https://msdnshared.blob.core.windows.net/media/2016/05/Freb_2.png" alt="Freb_2" width="425" height="452" /></a>

I am only interested in seeing compression related data in the IIS pipeline so I select only the WWW Server Providers and choose the Compression property. This will log only the compression related processing from IIS pipeline and it creates the minimum data for analyzing:

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/Freb_3.png"><img class="alignnone size-full wp-image-1096" src="https://msdnshared.blob.core.windows.net/media/2016/05/Freb_3.png" alt="Freb_3" width="618" height="537" /></a>

After reproducing the same behavior FREB logs will be created in the FREB logging directory.

<strong>REVIEWING THE DATA</strong>

When I open the FREB log for Site.css request, I confirm that IIS is actually respecting the minFileSizeForComp setting and the static compression does not happen for that request. The reason is shown as FILE_TOO_SMALL:

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/FREB_result_1.png"><img class="alignnone size-full wp-image-1097" src="https://msdnshared.blob.core.windows.net/media/2016/05/FREB_result_1.png" alt="FREB_result_1" width="718" height="158" /></a>

This proves that IIS respects the minFileSizeForComp setting. But why is the small CSS file compressed then? As seen in the same FREB results above, the CSS file is compressed because of Dynamic Compression and it also shows that the original size is 7 bytes and the result is 130 bytes! Well, obviously this is an undesirable behavior.

So the small file is not compressed because of static compression, instead it is compressed because of dynamic compression settings. Note that as I expressed at the beginning of this article minFileSizeForComp is ignored for dynamic compression which is a by-design behavior. That is why dynamic compression did not check if the file is smaller than the minFileSizeForComp value.

There should be some questions arising here:
<ul>
	<li>If a file is compressed by static compression, then is the same file compressed by dynamic compression again?</li>
	<li>How to avoid dynamic compression for this particular file?</li>
</ul>
The answer for the first question is NO, if a file is compressed by static compression then it will not be compressed by dynamic compression. Remember that I had another CSS file which was 117 KB (bootstrap.css) and it was larger than the 2700 bytes limit so it should have been compressed by static compression. If I check the FREB log for that file I can confirm that the static compression happened but dynamic compression did not:

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/FREB_result_2.png"><img class="alignnone size-full wp-image-1105" src="https://msdnshared.blob.core.windows.net/media/2016/05/FREB_result_2.png" alt="FREB_result_2" width="718" height="184" /></a>

As seen in the FREB log results above, the static compression is successful so IIS does not try to compress the same file with the dynamic compression and the ALREADY_CONTENT_ENCODING information is logged.

For the answer to the second question, let's please welcome the solution below.

<strong>SOLUTION</strong>

If you do not need dynamic compression then you can just disable it. This will avoid dynamic compression to happen at all. Please note that the dynamic compression should be used carefully since it may cause higher CPU usage on the server since it will not create the compressed version on the temporary folder on the disk (by default the folder is C:\inetpub\temp\IIS Temporary Compressed Files), meaning that the dynamic compression will happen for each request for the same file by default. This causes the CPU work for every request for the same file.

However, if you need Dynamic Compression, then you can tell IIS to not compress a certain file type with dynamic compression. You can do that at the site level with IIS Configuration Editor easily. To do so please follow the steps below:

1) Select your web site and choose IIS Configuration Editor under Management section and then choose system.webServer/httpCompression. Then click <strong>...</strong> to open the Dynamic Types settings:

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/IISConfigEditor.png"><img class="alignnone size-full wp-image-1106" src="https://msdnshared.blob.core.windows.net/media/2016/05/IISConfigEditor.png" alt="IISConfigEditor" width="930" height="318" /></a>

2) Then add the “text/css” as mimeType and set enabled=False, as seen in the screenshot below:

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/IISConfigEditor2.png"><img class="alignnone size-full wp-image-1115" src="https://msdnshared.blob.core.windows.net/media/2016/05/IISConfigEditor2.png" alt="IISConfigEditor2" width="605" height="321" /></a>

3) Do not forget to click Apply after closing the window above. It will make the necessary changes in the web.config file for your web site.

Now you can test it again and this time you should be able to see the small static file is not compressed. You can see a sample Fiddler output in the screenshot below. Note that the /Content/Bootstrap.css file is compressed because it is a larger file than the minFileSizeForComp value while the /Content/Site.css is served as uncompressed since the file size is 7 bytes and it is smaller than the minFileSizeForComp value:

<a href="https://msdnshared.blob.core.windows.net/media/2016/05/Fiddler_Final.png"><img class="alignnone size-full wp-image-1125" src="https://msdnshared.blob.core.windows.net/media/2016/05/Fiddler_Final.png" alt="Fiddler_Final" width="558" height="79" /></a>

<strong>SOME WORDS ABOUT BEST PRACTICES</strong>

I was discussing this issue with my friend and my colleauge <a href="https://linqto.me/about/pcociuba" target="_blank">Paul Cociuba</a> who works as an Escalation Engineer in Microsoft IIS Support Team. We agreed that it is a best practice not to serve several small CSS or JS files separately. Instead, using the <em>Bundling and Minification</em> techniques will improve the request times. The following article is a good read for those techniques:
<blockquote>Bundling and Minification
<a href="https://www.asp.net/mvc/overview/performance/bundling-and-minification">https://www.asp.net/mvc/overview/performance/bundling-and-minification</a></blockquote>
<strong>REFERENCES</strong>

HTTP Compression &lt;httpCompression&gt;
<a href="https://www.iis.net/configreference/system.webserver/httpcompression">https://www.iis.net/configreference/system.webserver/httpcompression</a>

Troubleshooting Failed Requests Using Tracing in IIS 7
<a href="https://www.iis.net/learn/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis">https://www.iis.net/learn/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis</a>

Editing Collections with Configuration Editor
<a href="https://www.iis.net/learn/manage/managing-your-configuration-settings/editing-collections-with-configuration-editor">https://www.iis.net/learn/manage/managing-your-configuration-settings/editing-collections-with-configuration-editor</a>

<strong>APPLIES TO</strong>

IIS 7.x and newer versions.

<strong>--
AMB</strong>]]></content:encoded>
    </item>
    <item>
      <title>Some IIS administration cmdlets run slowly in PowerShell 4.0</title>
      <link>https://docs.microsoft.com/archive/blogs/amb/some-iis-administration-cmdlets-run-slowly-in-powershell-4-0</link>
      <pubDate>Mon, 02 May 2016 09:56:01 GMT</pubDate>
      <dc:creator><![CDATA[Ahmet Mithat Bostanci]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/amb/?p=1026</guid>
      <description><![CDATA[I wrote a KB article about PowerShell IIS administration cmdlets when you run in Win 2008 or Win...]]></description>
      <content:encoded><![CDATA[I wrote a KB article about PowerShell IIS administration cmdlets when you run in Win 2008 or Win 2008 R2. If you are running New-WebApplication or ConvertTo-WebApplication cmdlets in Win 2008 or Win 2008 R2 then you may face with some performance issues. For the details and the workaround please see the following article:

Some IIS administration cmdlets run slowly in PowerShell 4.0
https://support.microsoft.com/en-us/kb/3144309

<strong>Applies To</strong>

Powershell 4.0 on Win 2008 or Win 2008 R2

<strong>--</strong>
<strong>AMB</strong>]]></content:encoded>
    </item>
    <item>
      <title>AppDomain is still unloaded when web.config file is changed even File Change Notifications (FCN) are disabled</title>
      <link>https://docs.microsoft.com/archive/blogs/amb/appdomain-is-still-unloaded-when-web-config-file-is-changed-even-file-change-notifications-fcn-are-disabled</link>
      <pubDate>Tue, 09 Feb 2016 10:36:00 GMT</pubDate>
      <dc:creator><![CDATA[Ahmet Mithat Bostanci]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/amb/2016/02/09/appdomain-is-still-unloaded-when-web-config-file-is-changed-even-file-change-notifications-fcn-are-disabled/</guid>
      <description><![CDATA[Let's assume that you are running an ASP.NET application and you disable the File Change...]]></description>
      <content:encoded><![CDATA[<p>Let's assume that you are running an ASP.NET application and you disable the File Change Notifications in web.config file (for ASP.NET 4.5 or later) or in the registry as explained in&nbsp;<a href="https://support.microsoft.com/kb/911272">https://support.microsoft.com/kb/911272</a>.</p>
<p>However the appDomains are still unloaded and reloaded when you change a web.config file.</p>
<p><strong>--</strong><br /><strong>AMB</strong></p>]]></content:encoded>
    </item>
    <item>
      <title>IIS 8.5 - How to log client port number</title>
      <link>https://docs.microsoft.com/archive/blogs/amb/iis-8-5-how-to-log-client-port-number</link>
      <pubDate>Thu, 12 Nov 2015 07:05:00 GMT</pubDate>
      <dc:creator><![CDATA[Ahmet Mithat Bostanci]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/amb/2015/11/12/iis-8-5-how-to-log-client-port-number/</guid>
      <description><![CDATA[When an HTTP request is made from a client machine to a web server, a TCP connection is established...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: verdana, geneva;">When an HTTP request is made from a client machine to a web server, a TCP connection is established between the client and the server machines. That TCP connection is built on the port numbers on both server and client sides. A web server, for example IIS, listens on port 80 for HTTP and on port 443 for SSL requests. Those are default ports of course and can be configured.</span></p>
<p><span style="font-family: verdana, geneva;">On the client side, operating system uses a random port number from an available port list, between 1024 &ndash; 65535.</span></p>
<p><span style="font-family: verdana, geneva;">You can read the following article for the TCP / IP details:</span></p>
<p><span style="font-family: verdana, geneva;">How TCP/IP Works</span><br /><span style="font-family: verdana, geneva;"> <a href="https://technet.microsoft.com/en-us/library/cc786128(v=ws.10).aspx">https://technet.microsoft.com/en-us/library/cc786128(v=ws.10).aspx</a></span></p>
<p><span style="font-family: verdana, geneva;"><strong>Getting the client port information</strong></span></p>
<p><span style="font-family: verdana, geneva;">IIS writes the server side port configured for the web site request on the IIS logs. However it does not write the client port and you may need to get that client port information for some reason.</span></p>
<p><span style="font-family: verdana, geneva;">Luckily that information is available on Server Variables. From Microsoft&rsquo;s explanation, the Server Variables means the following:</span><br /> <br /><span style="font-family: verdana, geneva;"> <em>IIS server variables provide information about the server, the connection with the client, and the current request on the connection. Ref.: <a href="https://msdn.microsoft.com/en-us/library/ms524602(v=vs.90).aspx">https://msdn.microsoft.com/en-us/library/ms524602(v=vs.90).aspx</a></em></span></p>
<p><span style="font-family: verdana, geneva;"><strong>Enhanced Logging feature of IIS 8.5</strong></span></p>
<p><span style="font-family: verdana, geneva;">In IIS 8.5, the administrator has the option of logging additional custom fields from request or response headers, or from server variables. Ref.: <a href="https://www.iis.net/learn/get-started/whats-new-in-iis-85/enhanced-logging-for-iis85">https://www.iis.net/learn/get-started/whats-new-in-iis-85/enhanced-logging-for-iis85</a></span></p>
<p><span style="font-family: verdana, geneva;">That means that we can log any information available in request or response headers, or in server variables.</span></p>
<p><span style="font-family: verdana, geneva;"><strong>Logging the client port number</strong></span></p>
<p><span style="font-family: verdana, geneva;">Client Port information is stored as REMOTE_PORT in server variables. So you can follow the instructions below:</span></p>
<ul>
<li><span style="font-family: verdana, geneva;">Open IIS 8.5 manager and choose the site you would like to configure logging with client port. You can do that on server level as well so all of the sites can log the client port.</span></li>
<li><span style="font-family: verdana, geneva;">Open Logging and choose Select Fields.</span></li>
<li><span style="font-family: verdana, geneva;">On Custom Fields section click Add Field.</span></li>
<li><span style="font-family: verdana, geneva;">Give a name for Field Name, note that you cannot use space.</span></li>
<li><span style="font-family: verdana, geneva;">Choose Server Variables from Source Type.</span></li>
<li><span style="font-family: verdana, geneva;">Type REMOTE_PORT in Source text box.</span></li>
<li><span style="font-family: verdana, geneva;">Click OK.&nbsp;</span></li>
</ul>
<p><span style="font-family: verdana, geneva;">You should be seeing something like below:</span></p>
<p><span style="font-family: verdana, geneva;">&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/94/93/6204.logging_client_ports.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-94-93/6204.logging_5F00_client_5F00_ports.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/94/93/6204.logging_client_ports.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x705/__key/communityserver-blogs-components-weblogfiles/00-00-00-94-93/6204.logging_5F00_client_5F00_ports.png" alt="" border="0" /></a></span></p>
<p><span style="font-family: verdana, geneva;">From that point on, you should be seeing the client TCP port logged in the IIS logs. A sample output is below. For readability reasons I disabled most of the logging fields. I also disabled the HTTP Keep-Alive for my test web site so each request I made from the same client just created a new TCP/IP connection:</span></p>
<p><span style="font-family: verdana, geneva;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/94/93/2728.logging_client_ports_logsample.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-94-93/2728.logging_5F00_client_5F00_ports_5F00_logsample.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/94/93/2728.logging_client_ports_logsample.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x138/__key/communityserver-blogs-components-weblogfiles/00-00-00-94-93/2728.logging_5F00_client_5F00_ports_5F00_logsample.png" alt="" border="0" /></a></span></p>
<p><span style="font-family: verdana, geneva;"><strong>Applies To:</strong></span></p>
<p><span style="font-family: verdana, geneva;">IIS 8.5 and onwards.</span></p>
<p><span style="font-family: verdana, geneva;">For IIS 7.0, 7.5 and 8.0 you can use Advanced Logging module (<a href="https://www.iis.net/downloads/microsoft/advanced-logging">https://www.iis.net/downloads/microsoft/advanced-logging</a>).</span></p>
<p><span style="font-family: verdana, geneva;"><strong>--</strong></span><br /><span style="font-family: verdana, geneva;"><strong>AMB</strong></span></p>]]></content:encoded>
    </item>
    <item>
      <title>Collecting a memory dump with ProcDump when ASP.NET ISAPI is reported unhealthy or deadlock detected in an ASP.NET application</title>
      <link>https://docs.microsoft.com/archive/blogs/amb/collecting-a-memory-dump-with-procdump-when-asp-net-isapi-is-reported-unhealthy-or-deadlock-detected-in-an-asp-net-application</link>
      <pubDate>Fri, 06 Nov 2015 06:47:00 GMT</pubDate>
      <dc:creator><![CDATA[Ahmet Mithat Bostanci]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/amb/2015/11/06/collecting-a-memory-dump-with-procdump-when-asp-net-isapi-is-reported-unhealthy-or-deadlock-detected-in-an-asp-net-application/</guid>
      <description><![CDATA[PROBLEM

 	You are running an ASP.NET application in IIS.
 	You noticed that the worker process...]]></description>
      <content:encoded><![CDATA[<span style="font-family: verdana, geneva"><strong>PROBLEM</strong></span>
<ul>
 	<li><span style="font-family: verdana, geneva">You are running an ASP.NET application in IIS.</span></li>
 	<li><span style="font-family: verdana, geneva">You noticed that the worker process shuts down and restarts.</span></li>
 	<li><span style="font-family: verdana, geneva">At the same time you see one or both of the following events in the event logs:</span></li>
</ul>
<span style="font-family: verdana, geneva">Event ID 2262: ISAPI 'C:\Windows\Microsoft.NET\Framework\&lt;version&gt;\aspnet_isapi.dll' reported itself as unhealthy for the following reason: 'Deadlock detected'.</span>

<span style="font-family: verdana, geneva">Event ID 5013: A process serving application pool 'app_pool name' exceeded time limits during shut down. The process id was '&lt;PID&gt;'.</span>

<span style="font-family: verdana, geneva"><strong>ACTION PLAN</strong></span>

<span style="font-family: verdana, geneva">Memory dump analysis is required to find out the root cause most of the times. You can follow the steps below to collect memory dumps automatically:</span>

<span style="font-family: verdana, geneva">1)  Download ProcDump from <a href="https://technet.microsoft.com/en-us/sysinternals/dd996900.aspx">https://technet.microsoft.com/en-us/sysinternals/dd996900.aspx</a> on your server and extract it.</span>

<span style="font-family: verdana, geneva">2)  Copy the ProcDump.exe, ProcDump64.exe and Eula.txt files to both C:\Windows\System32 and C:\Windows\SysWOW64 folders.</span>

<span style="font-family: verdana, geneva">3)  Create C:\Dumps folder where the dump files are written. You can use another local disk or folder but you should change it in the step 5.</span>

<span style="font-family: verdana, geneva">4)  Open IIS manager, find your application pool which is reported unhealthy and open its advanced settings.</span>

<span style="font-family: verdana, geneva">5)  Find Process Orphaning settings and configure it as below, as seen in the screenshot:</span>
<ol>
 	<li><span style="font-family: verdana, geneva">Enabled: True</span></li>
 	<li><span style="font-family: verdana, geneva">Executable: c:\windows\system32\procdump.exe</span></li>
 	<li><span style="font-family: verdana, geneva">Executable Parameters (if your application pool is 32bit): -accepteula -ma %1% c:\Dumps</span></li>
 	<li><span style="font-family: verdana, geneva">Executable Parameters (if your application pool is 64bit): -accepteula -64 -ma %1% c:\Dumps
</span>
<span style="font-family: verdana, geneva"> </span><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/80/1780.AppPool_Process_Orphaning_Configuration.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/62/80/1780.AppPool_Process_Orphaning_Configuration.png" alt="Configuration Screenshot" /></a></li>
</ol>
<span style="font-family: verdana, geneva">6)  Click OK to close the dialog box. When the same issue happens the dump(s) should be generated in the c:\Dumps (or where you configured) folder.</span>

<span style="font-family: verdana, geneva"><strong>NOTES</strong></span>

<span style="font-family: verdana, geneva">1)  Do not forget to disable Process Orphaning when the dumps are collected.</span>

<span style="font-family: verdana, geneva">2)  A memory dump is a snapshot of a process memory so the size of a dump file will be approximately the same as the size of the process in the memory. For example, if a process consumes 2 GB of memory when taking the dump, then the dump file will take approximately 2 GB in the disk. Please set a location where you have enough free disk space.</span>

<span style="font-family: verdana, geneva">3)  Avoid writing dumps to a network share or a slow disk (is there any slow disk left?) because when a dump is being written, all threads of the process will be suspended. Any requests arrive while the dump is written will be queued until the dump file is completed.</span>

<span style="font-family: verdana, geneva"><strong>TIP FOR ANALYZING THE MEMORY DUMP</strong></span>

<span style="font-family: verdana, geneva">The issue described in the PROBLEM section may be mostly related with some requests waiting to acquire a lock which is owned by another thread. If a lock is not relased for enough time, IIS assumes that the process is deadlocked and WAS terminates the worker process, reports it as unhealthy and restarts a new one.</span>

<span style="font-family: verdana, geneva">You can open the dump in WinDBG and use SOS extension's SyncBlk command to analyze the locks. Try to find out which thread owns the lock and why it does not release that (e.g.: thread may be doing a long running task in a lock). You can also use Debug Diagnostic's Auto Analyse feature and review the report generated.</span>

<span style="font-family: verdana, geneva"><strong>MORE INFORMATION</strong></span>

<span style="font-family: verdana, geneva">Process Orphaning feature of IIS allows you to avoid terminating the “unhealthy” or “deadlocked” process so the “orphaned” process could live in the memory, without accepting any requests, for troubleshooting purposes (for example attaching a debugger to it or taking the dumps of it).</span>

<span style="font-family: verdana, geneva"><strong>REFERENCES</strong></span>

<span style="font-family: verdana, geneva">Managing, Tuning, and Configuring Application Pools in IIS 7.0</span>
<span style="font-family: verdana, geneva"><a href="https://technet.microsoft.com/en-us/library/cc745955.aspx">https://technet.microsoft.com/en-us/library/cc745955.aspx</a></span>

<span style="font-family: verdana, geneva"><strong>APPLIES TO</strong></span>

<span style="font-family: verdana, geneva">All supported IIS versions</span>
<span style="font-family: verdana, geneva">All ASP.NET versions</span>]]></content:encoded>
    </item>
    <item>
      <title>IIS application pool may be terminated while collecting dump</title>
      <link>https://docs.microsoft.com/archive/blogs/amb/iis-application-pool-may-be-terminated-while-collecting-dump</link>
      <pubDate>Thu, 26 Mar 2015 05:04:00 GMT</pubDate>
      <dc:creator><![CDATA[Ahmet Mithat Bostanci]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/amb/2015/03/26/iis-application-pool-may-be-terminated-while-collecting-dump/</guid>
      <description><![CDATA[Consider the following scenario:

	You are running a web application on IIS and you need to...]]></description>
      <content:encoded><![CDATA[<span style="font-family: verdana,geneva">Consider the following scenario:</span>
<ul>
	<li><span style="font-family: verdana,geneva">You are running a web application on IIS and you need to collect a memory dump of the application pool process (w3wp.exe).</span></li>
	<li><span style="font-family: verdana,geneva">W3wp.exe in subject consumes huge memory, for example, around 40 GB, and it takes some time to write the dump file.</span></li>
	<li><span style="font-family: verdana,geneva">When you try to collect a memory dump of the worker process, it is terminated and the memory dump is corrupted.</span></li>
</ul>
<span style="font-family: verdana,geneva">This may be happening because of the “health monitoring” configuration of the application pool. For example the following screenshot shows the default settings for health monitoring:</span>

<span style="font-family: verdana,geneva"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/94/93/5164.apppoolsettings.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/94/93/5164.apppoolsettings.png" alt="" border="0" /></a></span>
<span style="font-family: verdana,geneva">The following happens with the default configuration seen in the screenshot above:</span>
<ul>
	<li><span style="font-family: verdana,geneva">WAS will monitor application pool by pinging it every 30 seconds (Ping Period configuration).</span></li>
	<li><span style="font-family: verdana,geneva">If the process does not respond in 90 seconds (Ping Maximum Response Time) then WAS will terminate the process.</span></li>
</ul>
<span style="font-family: verdana,geneva">Remember that the process is suspended when a dump is written to the disk, which means that it will not respond to WAS’ ping request and if that exceeds the ping maximum response times then WAS will terminate the process.</span>

<span style="font-family: verdana,geneva">If you see the similar behavior and you need to collect a useful dump then you may need to increase the ping timeout or set “ping enabled” to false until you collect the memory dump. </span>

<span style="font-family: verdana,geneva">Please note that changing these settings will cause application pool recycle.</span>

<strong style="font-family: verdana, geneva">--
</strong><strong style="font-family: verdana, geneva">AMB</strong>]]></content:encoded>
    </item>
    <item>
      <title>Free e-book - Windows 8.1 Universal application development</title>
      <link>https://docs.microsoft.com/archive/blogs/amb/free-e-book-windows-8-1-universal-application-development</link>
      <pubDate>Tue, 24 Mar 2015 05:11:02 GMT</pubDate>
      <dc:creator><![CDATA[Ahmet Mithat Bostanci]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/amb/2015/03/24/free-e-book-windows-8-1-universal-application-development/</guid>
      <description><![CDATA[A colleague of mine, Matteo Pagani, has published a free e-book about Windows 8.1 Universal...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: verdana, geneva;">A colleague of mine, Matteo Pagani, has published a free e-book about Windows 8.1 Universal Application Development, it is a second part of the same topic. Below is what he says about it:</span></p>
<p><span style="font-family: verdana, geneva;"><strong>More Windows 8.1 Succinctly</strong></span></p>
<p><span style="font-family: verdana, geneva;">Move beyond the development stage and present your apps to the world. In this final volume, author Matteo Pagani guides you through the process of readying your Windows 8.1 and Windows Phone 8.1 apps for the Windows Store. You&rsquo;ll learn how to integrate your app into Microsoft&rsquo;s infrastructure to maximize its functionality and appeal.</span></p>
<p><span style="font-family: verdana, geneva;"><strong>Table of Contents </strong></span></p>
<ol start="1">
<li><span style="font-family: verdana, geneva;">Publishing an Application on the Store</span></li>
<li><span style="font-family: verdana, geneva;">Interacting with the Network</span></li>
<li><span style="font-family: verdana, geneva;">Interacting with the Real World</span></li>
<li><span style="font-family: verdana, geneva;">Contracts and Extensions</span></li>
<li><span style="font-family: verdana, geneva;">Creating Multimedia Applications</span></li>
<li><span style="font-family: verdana, geneva;">Tiles and Notifications</span></li>
<li><span style="font-family: verdana, geneva;">Supporting Background Operations</span></li>
</ol>
<p><span style="font-family: verdana, geneva;">You can get a copy of the e-book from the following site:</span></p>
<p><span style="font-family: verdana, geneva;"><a href="https://www.syncfusion.com/resources/techportal/ebooks/morewindows8.1">https://www.syncfusion.com/resources/techportal/ebooks/morewindows8.1</a></span></p>
<p><span style="font-family: verdana, geneva;"><strong>--<br /> AMB</strong></span></p>]]></content:encoded>
    </item>
    <item>
      <title>Everyone can build an app – introducing Windows Phone App Studio beta</title>
      <link>https://docs.microsoft.com/archive/blogs/amb/everyone-can-build-an-app-introducing-windows-phone-app-studio-beta</link>
      <pubDate>Tue, 06 Aug 2013 14:28:41 GMT</pubDate>
      <dc:creator><![CDATA[Ahmet Mithat Bostanci]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/amb/2013/08/06/everyone-can-build-an-app-introducing-windows-phone-app-studio-beta/</guid>
      <description><![CDATA["Windows Phone App Studio is about giving everyone the ability to create an app, regardless of...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: verdana, geneva;"><em>"Windows Phone App Studio is about giving everyone the ability to create an app, regardless of experience. It also can radically accelerate workflow for all developers."</em></span></p>
<p><span style="font-family: verdana, geneva;">Read the full story at&nbsp;<a href="https://blogs.windows.com/windows_phone/b/wpdev/archive/2013/08/06/everyone-can-build-an-app-introducing-windows-phone-app-studio-beta.aspx">Windows Phone Developer Blog</a>.</span></p>
<p><span style="font-family: verdana, geneva;"><strong>--</strong></span><br /><span style="font-family: verdana, geneva;"><strong>AMB</strong></span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Free e-book collection</title>
      <link>https://docs.microsoft.com/archive/blogs/amb/free-e-book-collection</link>
      <pubDate>Fri, 21 Jun 2013 00:59:35 GMT</pubDate>
      <dc:creator><![CDATA[Ahmet Mithat Bostanci]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/amb/2013/06/21/free-e-book-collection/</guid>
      <description><![CDATA[Hello,
one of my colleauges shared the following blog post which provides a list for free e-books...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: verdana,geneva;">Hello,</span></p>
<p><span style="font-family: verdana,geneva;">one of my colleauges shared the following blog post which provides a list for free e-books for different technologies including web and mobile development. Definetly it is worth to check:</span></p>
<p><span style="font-family: verdana,geneva;">Huge collection of Free Microsoft eBooks for you, including: Office, Office 365, SharePoint, SQL Server, System Center, Visual Studio, Web Development, Windows, Windows Azure, and Windows Server</span><br /><span style="font-family: verdana,geneva;"><a href="https://blogs.msdn.com/b/mssmallbiz/archive/2013/06/18/huge-collection-of-free-microsoft-ebooks-for-you-including-office-office-365-sharepoint-sql-server-system-center-visual-studio-web-development-windows-windows-azure-and-windows-server.aspx">https://blogs.msdn.com/b/mssmallbiz/archive/2013/06/18/huge-collection-of-free-microsoft-ebooks-for-you-including-office-office-365-sharepoint-sql-server-system-center-visual-studio-web-development-windows-windows-azure-and-windows-server.aspx</a></span></p>
<p><span style="font-family: verdana,geneva;">Enjoy :)</span></p>
<p><span style="font-family: verdana,geneva;"><strong>--</strong></span><br /><span style="font-family: verdana,geneva;"><strong>AMB</strong></span></p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
  </channel>
</rss>