<?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>Parvez's Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/parvez/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/parvez/feed.xml</link>
    <description />
    <lastBuildDate>Tue, 16 Apr 2019 06:20:05 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>IIS Application Pool Crash and Debug Diag</title>
      <link>https://docs.microsoft.com/archive/blogs/parvez/iis-application-pool-crash-and-debug-diag</link>
      <pubDate>Sat, 06 Aug 2016 22:08:58 GMT</pubDate>
      <dc:creator><![CDATA[Parvez N Mulla]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/parvez/?p=115</guid>
      <description><![CDATA[Introduction

If you observe either of the following events under the system logs in Event Viewer,...]]></description>
      <content:encoded><![CDATA[<strong>Introduction</strong>

If you observe either of the following events under the system logs in Event Viewer, then this article is meant for you.

<strong>A process serving application pool '%1' suffered a fatal communication error with the Windows Process Activation Service. The process id was '%2'. The data field contains the error number.</strong>

<strong>A process serving application pool '%1' terminated unexpectedly. The process id was '%2'. The process exit code was '%3'.</strong>

This is a clear indication of an application pool crash issue wherein something went wrong within the application and the application pool had to be terminated. Once the application pool is terminated, its corresponding w3wp process is also terminated. Hence, if you have saved any cache/sesson based information within the w3wp process, it gets completely wiped out.

Ideally, when an application pool crashes, in order to honor the incoming requests, a new w3wp process gets spawned up automatically. However, if the application pool crashes more than 5 times within a period of 5 minutes, then the application pool goes into a stopped state. You will have to restart the application pool manually to get it up and running. You will observe the following event under system logs in Event Viewer if something similar happens.

<strong>Application pool '%1' is being automatically disabled due to a series of failures in the process(es) serving that application pool.</strong>

You can modify this setting under "Rapid Fail Protection" section present under Advanced settings of the respective application pool. It is "Enabled" by Default.
<p style="text-align: left"><a href="https://msdnshared.blob.core.windows.net/media/2016/08/17.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2016/08/17-246x300.jpg" alt="1" width="246" height="300" class="alignnone size-medium wp-image-125" /></a></p>
<strong>Capture Dumps</strong>

Now that we know that our application pool has crashed, the next step is to determine why exactly it crashed. In order to determine this, we will have to capture a dump of the w3wp process just before it terminates. There are multiple ways to do this. You can set up WER, procdump and Debug Diag to capture a crash dump. In this article, I will discuss only the Debug Diag  way of capturing data.

<strong>Debug Diag</strong>

This is by far the easiest and the most sophisticated tool to capture a crash dump of an application pool. This is how we set it up. You can download it from <a target="_blank" href="https://www.microsoft.com/en-us/download/details.aspx?id=49924">here</a>.

<strong>Launch debug diag and select “crash” rule.</strong>
<p style="text-align: left"><a href="https://msdnshared.blob.core.windows.net/media/2016/08/26.png"><img src="https://msdnshared.blob.core.windows.net/media/2016/08/26-300x264.png" alt="2" width="300" height="264" class="alignnone size-medium wp-image-135" /></a></p>
<p style="text-align: left"><strong>Select “A specific IIS web application pool”</strong></p>
<p style="text-align: left"><a href="https://msdnshared.blob.core.windows.net/media/2016/08/38.png"><img src="https://msdnshared.blob.core.windows.net/media/2016/08/38-300x262.png" alt="3" width="300" height="262" class="alignnone size-medium wp-image-145" /></a></p>
<p style="text-align: left"><strong>Select the specific application pool which is crashing.</strong></p>
<p style="text-align: left"><a href="https://msdnshared.blob.core.windows.net/media/2016/08/71.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2016/08/71-300x261.jpg" alt="7" width="300" height="261" class="alignnone size-medium wp-image-185" /></a></p>
You might also receive a pop up indicating that the IIS management compatibility feature is not installed and that the application pools will not be listed. Not to worry ! Just click on OK and type in the application name manually in the above window.
<p style="text-align: left"><strong>Select “Breakpoint”</strong></p>
<p style="text-align: left"><a href="https://msdnshared.blob.core.windows.net/media/2016/08/46.png"><img src="https://msdnshared.blob.core.windows.net/media/2016/08/46-300x264.png" alt="4" width="300" height="264" class="alignnone size-medium wp-image-155" /></a></p>
<p style="text-align: left"><strong>Click on “Add breakpoint”</strong></p>
<p style="text-align: left"><a href="https://msdnshared.blob.core.windows.net/media/2016/08/53.png"><img src="https://msdnshared.blob.core.windows.net/media/2016/08/53-300x198.png" alt="5" width="300" height="198" class="alignnone size-medium wp-image-165" /></a></p>
<p style="text-align: left"><strong>Click on “Ntdll!ZwTerminateProcess” under Breakpoint such that it is selected as the Breakpoint Expression. Change Action Type to “Full userdump” and set Action Limit to 10 and click on OK. </strong></p>
<p style="text-align: left"><a href="https://msdnshared.blob.core.windows.net/media/2016/08/63.png"><img src="https://msdnshared.blob.core.windows.net/media/2016/08/63-300x286.png" alt="6" width="300" height="286" class="alignnone size-medium wp-image-175" /></a></p>
<p style="text-align: left">Action Type indicates the type of dump that would be captured. A mini user dump will not provide complete information of the issue as it captures very minimal data of the w3wp process.</p>
<p style="text-align: left">Action Limit indicates the number of dumps that this rule will capture.</p>
<p style="text-align: left"><strong>Click on Save and close</strong></p>
<p style="text-align: left"><img src="https://msdnshared.blob.core.windows.net/media/2016/08/131-300x222.jpg" alt="13" width="300" height="222" class="alignnone size-medium wp-image-245" /></p>
<p style="text-align: left"><strong>Click on Next to activate the breakpoint</strong></p>
<p style="text-align: left"><a href="https://msdnshared.blob.core.windows.net/media/2016/08/121.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2016/08/121-300x262.jpg" alt="12" width="300" height="262" class="alignnone size-medium wp-image-235" /></a></p>
<p style="text-align: left"><strong>Click on "Next"
</strong></p>
<p style="text-align: left"> <a href="https://msdnshared.blob.core.windows.net/media/2016/08/21.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2016/08/21-300x263.jpg" alt="21" width="300" height="263" class="alignnone size-medium wp-image-285" /></a></p>
In the above section, you can change the path where the dumps will be stored. The size of each dump file will be the same as that consumed by w3wp process in the memory. So, keeping that in mind, place the dumps in a drive that has enough free disk space.
<p style="text-align: left"><strong>Click on "Finish" to activate the Rule.</strong></p>
<p style="text-align: left"><img src="https://msdnshared.blob.core.windows.net/media/2016/08/20-300x262.jpg" alt="20" width="300" height="262" class="alignnone size-medium wp-image-275" /></p>
<p style="text-align: left">You will now see that the crash rule is in active state and the "Userdump Count" is 0. As soon as the issue occurs, the dump count will increase and a corresponding dump file will be generated.</p>
<p style="text-align: left">PS: A normal recycle of the application pool will also trigger a dump. This is because when the application pool recycles, its corresponding w3wp process's PID changes and hence a dump gets generated. This is a false positive dump and will not help in the analysis of the application pool crash issue. So whenever you see an increment in the userdump count, check the event logs to see if the above mentioned crash events have occurred. If yes, then the dump that has been captured is correct.</p>
<p style="text-align: left"><strong>Dump Analysis</strong></p>
<p style="text-align: left">Once the dump is captured, you can use the Debug Diag Analysis executable to analyse the captured crash dump. Just a "double click" on the dump will also work. Make sure you have the symbol path set right. To check this, select Tools --&gt; Options and settings and make sure your "Symbol Search Path for Analysis" and "Symbol Search path for Debugging" are set to "srv*c:\symcache*https://msdl.microsoft.com/download/symbols".</p>
<p style="text-align: left"><a href="https://msdnshared.blob.core.windows.net/media/2016/08/141.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2016/08/141-300x260.jpg" alt="14" width="300" height="260" class="alignnone size-medium wp-image-265" /></a></p>
<p style="text-align: left">Once the report is generated, you can open it in IE and understand the call stack of the thread that triggered the Breakpoint Expression. Read the call stack from bottom to top and figure out which method or component triggered the application pool to crash</p>
<p style="text-align: left">Hope this helps :)</p>
&nbsp;

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>IIS Bindings</title>
      <link>https://docs.microsoft.com/archive/blogs/parvez/iis-bindings</link>
      <pubDate>Wed, 27 Jul 2016 18:11:18 GMT</pubDate>
      <dc:creator><![CDATA[Parvez N Mulla]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/parvez/?p=75</guid>
      <description><![CDATA[Introduction

A binding is an attribute of a website which is used to uniquely identify itself and...]]></description>
      <content:encoded><![CDATA[<strong>Introduction</strong>

A binding is an attribute of a website which is used to uniquely identify itself and consists of a combination of IP, Port and the Hostname.

Basically Binding = IP + Port + Hostname

<strong>Confusion</strong>

So if its that simple, where and when does the confusion arise? Consider a situation where you have multiple websites hosted on an IIS machine. When a request reaches this web server, how does it decide as to which website this request should go to? This is where the knowledge of Bindings can be useful. For two or more websites to run successfully on IIS, their Bindings have to be unique. It basically means that either one of the following attributes - IP, Port or Hostname has to be different.

<strong>HTTP</strong>

<span>The default port that HTTP requests use is port 80. </span>

Consider an example where website A has the following Binding.

<strong>IP</strong>: 10.10.10.1 <strong>Port</strong>:80 <strong>Hostname</strong>: contosso.com

If another website website B has to be hosted on the same server, atleast one of the above attributes has to be different.

So, Website B can have either of the following Bindings.
<ul>
 	<li><strong>IP</strong>: 10.10.10.1 <strong>Port</strong>:80 <strong>Hostname</strong>: Test.com</li>
 	<li><strong>IP</strong>: 10.10.10.1 <strong>Port</strong>:8080 <strong>Hostname</strong>: Contosso.com</li>
 	<li><strong>IP</strong>: 20.20.20.2 <strong>Port</strong>:80 <strong>Hostname</strong>: Contosso.com</li>
</ul>
Option 1 is something that is feasible, scalable and easier to manage. Since port 80 is the default port of HTTP protocol,  if a website is listening on any other port other than 80 , it has to be specified by the user in the browser which becomes a little tedious. Ideally, each website will be accessed using its Hostname. So having a different Hostname rather than a different Port makes more sense. This way, you can host multiple websites without any difficulty.

Option 2 is generally used when you have website B as the backup for website A. Website A usually contains the latest code release and website B contains the last working code. If, for some reason website A goes down, the administrator can immediately stop website A, modify the port number of website B and get the last working code up and running.

Option 3 is used if you have an additional IP address added to the machine.

<strong>HTTPS - Windows server 2008 R2</strong>

The default port that HTTPS requests use is port 443. There is a small twist in the way requests are routed to individual websites in case of websites running over HTTPS. As we discussed earlier, to uniquely establish two websites having HTTP bindings, we used the combination of IP, Port and Hostname. However, in case of two or more websites having HTTPS binding, they can be established using the combination of IP and Port only. This is because, during the SSL handshake, only IP and Port details are available. Hence, hostname does not play any part in determining the website that the request should go to.

If you observe the Bindings section while adding an HTTPS binding, the Hostname section will be greyed out.

<a href="https://msdnshared.blob.core.windows.net/media/2016/07/118.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2016/07/118-300x164.jpg" alt="1" width="300" height="164" class="alignnone size-medium wp-image-85" /></a>

Consider an example where website A has the following Binding.

<strong>IP</strong>: 10.10.10.1 <strong>Port</strong>:443

If another website website B has to be hosted on the same server, either of the above attributes has to be different.

So, Website B can have either of the following Bindings.
<ul>
 	<li><strong>IP</strong>: 20.20.20.2 <strong>Port</strong>:443</li>
 	<li><strong>IP</strong>: 10.10.10.1 <strong>Port</strong>:445</li>
</ul>
<span>Option 1 </span><span>is used if you have an additional IP address added to the machine</span><span>. This is the most feasible option for HTTPS websites on a windows server 2008 R2 machine.</span>

Option 2 can be used but is not feasible since it uses a port number that is different than the default HTTPS port(443). The disadvantage is that the users will have to specifically mention the port number in the URL of the website that they intend to access. Example: https://www.contosso.com:445

<strong>Special case of using wildcard certificates</strong> - <strong>Windows server 2008 R2</strong>

Consider an example where website A has the following Binding - <strong>IP</strong>: 10.10.10.1 <strong>Port</strong>: 443 and is supposed to be accessed using the <strong>Hostname</strong>: website1.contosso.com

If another website website B has to be hosted on the same server with the <strong>Hostname</strong>: website2.contosso.com, then we can assign the same IP and Port combination to both the websites in the IIS manager.

But two websites running with the same IP and Port combination will result in a conflict. So, in order to uniquely identify the websites and make sure that the request reaches the correct website, the "Bindings" section under "sites" attribute in the <strong>applicationHost.config</strong> file will have to be modified in the following manner.

For website A,

&lt;binding protocol="https" bindingInformation="10.10.10.1:443:website1.contosso.com" /&gt;

<span>For website B,</span>

<span>&lt;binding protocol="https" bindingInformation="</span><span>10.10.10.1</span><span>:443:website2.contosso.com" /&gt;</span>

<strong>HTTPS - Windows server 2012 R2</strong>

The major disadvantage with windows server 2008 R2 machine was Scalability. Hosting multiple websites required users to configure multiple IP addresses on the machine or have the users access the website using an unconventional port.

In order to rectify this problem, a very important feature called "Server name Indication(SNI)" was introduced.

<img src="https://msdnshared.blob.core.windows.net/media/2016/07/27-300x146.jpg" alt="2" width="300" height="146" class="alignnone size-medium wp-image-95" />

SNI allows us to utilize all three attributes of a binding - IP , Port and Hostname that we used previously with HTTP based websites to uniquely identify themselves. Most of the new browsers support the SNI feature. You can refer to <a href="https://blogs.msdn.microsoft.com/kaushal/2012/09/04/server-name-indication-sni-with-iis-8-windows-server-2012/" target="_blank">this blog</a> for more information on SNI and how it can be configured.

<strong>Summary</strong>

<strong>HTTP</strong> = IP + Port + hostname

<strong>HTTPS</strong> [windows server 2008 R2] = IP + Port

<span><strong>HTTPS</strong> [windows server 2012 R2] = IP + Port + Hostname</span>

Hope this helps :)

&nbsp;

&nbsp;

&nbsp;

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Authentication Precedence and Behavior in IIS</title>
      <link>https://docs.microsoft.com/archive/blogs/parvez/authentication-precedence-in-iis</link>
      <pubDate>Sat, 21 Sep 2013 10:48:00 GMT</pubDate>
      <dc:creator><![CDATA[Parvez N Mulla]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/parvez/2013/09/21/authentication-precedence-in-iis/</guid>
      <description><![CDATA[Introduction
This blog seeks to explain which authentication mode will take precedence when...]]></description>
      <content:encoded><![CDATA[<h2 style="text-align: justify"><span style="color: #800000;font-size: large">Introduction</span></h2>
<p style="text-align: justify"><span lang="EN">This blog seeks to explain which authentication mode will take precedence when multiple authentication mechanisms like Anonymous, Basic, Windows are enabled. Please note that the following instructions are applicable only to ASP.Net applications and Internet Explorer.</span></p>

<h2 style="text-align: justify"><span style="color: #800000;font-size: large">Authentication Precedence</span></h2>
<p style="text-align: left">The best way to find out which authentication mode will take precedence is to revisit the IIS 6 Directory security Tab. The order in which authentication modes are presented from top to bottom indicates the authentication precedence. For example, Anonymous Authentication will take precedence over Windows, Digest and Basic authentication. However, if the client Certificate Authentication is configured, then it will take precedence above all other authentication mechanisms since the SSL handshake takes place even before the HTTP request comes into picture.</p>
<p class="separator"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/48/8688.6.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/48/8688.6.jpg" alt="" width="378" height="450" /></a></p>
<p class="separator">To Summarize everything, this is how the authentication precedence looks like.</p>

<ul>
	<li>Client Certificate Authentication</li>
	<li>Anonymous authentication</li>
	<li>Windows authentication</li>
	<li>Basic authentication</li>
</ul>
<h2 style="text-align: justify"><span style="color: #800000;font-size: large">Authentication Behavior</span></h2>
<strong>Scenario 1 - Only Anonymous authentication enabled</strong>
<p style="text-align: justify">Under any given circumstances, when a client makes the first request to the server, it will be anonymous. On the server side, if the application is also configured to run under anonymous authentication, then the server will process the request and send the desired response back to the client without requesting any further validation from the client.</p>
<p style="text-align: justify"><strong>Scenario 2 - Multiple authentication modes enabled</strong></p>
Let us assume that both Basic and Windows authentication have been enabled on the server at the application level. When the first anonymous request from the client reaches the server, the server checks the application's configuration and understands that it is configured to run under Basic/Windows authentication. Since these authentication mechanisms need further validation to deliver the required page, the server sends the authentication details to the client and requests for further validation. The client picks up the most secure authentication mechanism(windows) from the list provided by the server and takes necessary steps to provide the required information to the server.

It is incorrect to assume that if two authentication modes are configured and if one fails, the request will fall back to other authentication mode. If you consider my previous example, I stated that if Windows Authentication and Basic Authentication are enabled, Windows authentication will take precedence. Now, if Windows authentication fails, it will never fall back to Basic and take it forward from there.
<p class="separator" style="text-align: justify">A fall back would mostly occur only in following scenarios.</p>

<ul style="text-align: justify">
	<li><strong>Scenario 1: </strong>Under Windows Authentication, if Kerberos fails, it will fall back to NTLM</li>
	<li><strong>Scenario 2: </strong>If client Certificate Authentication and Anonymous authentication are enabled on the server at the application and if client Certificate Authentication fails, then the request will fall back to Anonymous authentication. If you're setting up client certificate authentication in your environment, please make sure you have anonymous authentication disabled so that you don't end up receiving false positive answers.</li>
</ul>
Hope this helps :)]]></content:encoded>
    </item>
  </channel>
</rss>