<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>TechReflections</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/techreflections/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/techreflections/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:27:33 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Speaking at the SQLServerGeeks Annual Summit 2016</title>
      <link>https://docs.microsoft.com/archive/blogs/techreflections/speaking-at-the-sqlservergeeks-annual-summit-2016</link>
      <pubDate>Sun, 07 Aug 2016 19:00:23 GMT</pubDate>
      <dc:creator><![CDATA[Devashish_Salgaonkar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/techreflections/?p=145</guid>
      <description><![CDATA[I will speaking at the SQL Server Geeks Annual Summit (#SSGAS2016) which is Asia’s Premier Data...]]></description>
      <content:encoded><![CDATA[I will speaking at the <strong><a href="http://www.sqlservergeeks.com/summit2016/">SQL Server Geeks Annual Summit</a></strong><span> (</span><a href="https://twitter.com/search?q=%23SSGAS2016">#SSGAS2016</a><span>)</span> which is <span>Asia’s Premier Data &amp; Analytics Conference taking place on 11-13 August in Bangalore, India. SQLServerGeeks Annual Summit 2016 is a full 3-day conference with more than 100 breakout sessions and deep dive pre-con sessions on SQL Server, BI &amp; Analytics, Cloud, Big Data, and related technologies.</span>

Below are the details of some of the sessions I will be delivering -
<table width="843">
<tbody>
<tr>
<td width="224"><strong>Session Type</strong></td>
<td width="488"><strong>Session Title</strong></td>
<td width="191"><strong>Level</strong></td>
<td width="223"><strong>Track(s)</strong></td>
<td width="163"><strong>Date</strong></td>
<td width="199"><strong>Time</strong></td>
</tr>
<tr>
<td width="224">Chalk-Talk</td>
<td width="488">Stretching Your Database to the Cloud</td>
<td width="191"></td>
<td width="223"></td>
<td width="163">13-Aug-16</td>
<td width="199">09:30 - 10:00</td>
</tr>
<tr>
<td width="224">Breakout</td>
<td width="488">SQL Server on Azure Iaas  - Performance Best Practices and Lessons Learnt from the Field</td>
<td width="191">Intermediate/Advanced</td>
<td width="223">CLOUD/DBA</td>
<td width="163">13-Aug-16</td>
<td width="199">12:00 – 13:15</td>
</tr>
<tr>
<td width="224">Open-Talk</td>
<td width="488">How Columnstore Indexes Can Speed Up Your Query Performance</td>
<td width="191"></td>
<td width="223"></td>
<td width="163">13-Aug-16</td>
<td width="199">15:15 – 15:45</td>
</tr>
</tbody>
</table>
&nbsp;

<hr />

Here is the excerpt for my Breakout session - <a href="http://www.sqlservergeeks.com/summit2016/"><img src="https://msdnshared.blob.core.windows.net/media/2016/08/Web-Banner-2-109x300.jpg" alt="Web Banner (2)" width="152" height="419" class="alignright wp-image-156" /></a>

<strong>SQL Server on Azure Iaas  - Performance Best Practices and Lessons Learnt from the Field</strong>

<em>With the advent of the cloud world, SQL Server deployments on Azure Infrastructure as a Service (IaaS) have increased. </em>

<em>Although the Microsoft platform makes it very easy to deploy a VM’s in Azure, there are a some</em><em> best practices to ensure that the SQL Server deployed is performant.</em>

<em>In this session, we will talk about these performance best practices along with common pitfalls which are encountered while working with SQL Server on IaaS.</em>

Many of colleagues from Microsoft are also delivering multiple sessions at this conference. You can access the complete list <a href="http://www.sqlservergeeks.com/summit2016/breakout-sessions/">here</a>.

<span>Follow  </span><a target="_blank" href="https://twitter.com/SQLServerGeeks">SQLServerGeeks</a><span> and the </span><strong><a href="https://twitter.com/search?q=%23SSGAS2016">#SSGAS2016</a></strong><span> hashtag on Twitter for new and exciting updates about the conference. Be there if you are a Data Professional who wants to learn about the latest in the database world.</span>

&nbsp;

&nbsp;

&nbsp;

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Stretch your database onto the cloud</title>
      <link>https://docs.microsoft.com/archive/blogs/techreflections/stretch-your-database-onto-the-cloud</link>
      <pubDate>Sun, 17 Jul 2016 06:11:59 GMT</pubDate>
      <dc:creator><![CDATA[Devashish_Salgaonkar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/techreflections/?p=95</guid>
      <description><![CDATA[I recently delivered an online webinar on one of the new features of SQL Server 2016 - Stretch...]]></description>
      <content:encoded><![CDATA[I recently delivered an online webinar on one of the new features of <a href="https://www.eventbrite.com/e/introduction-to-stretch-databases-webinar-tickets-26349197158" target="_blank">SQL Server 2016 - Stretch Database</a>. This was the first session of the webinar series organized by SQL Server Delhi NCR Community PASS Chapter.

<a href="https://msdnshared.blob.core.windows.net/media/2016/07/Stretch_DB.png" rel="attachment wp-att-125"><img class="size-full wp-image-125 aligncenter" src="https://msdnshared.blob.core.windows.net/media/2016/07/Stretch_DB.png" alt="Stretch_DB" width="290" height="185" /></a>

There was a good turnout of SQL enthusiasts for the session. This being one of the new features in the gamut of SQL 2016 features, there was lot of inquisitiveness and good number of questions from the audience as well.

I am sharing the presentation deck and demo scripts as an <a href="https://msdnshared.blob.core.windows.net/media/2016/07/Stretch-Database.zip" rel="">attachment</a> to this blog post. The demo scripts use the AdventureWorks database which can be downloaded from <a href="https://www.microsoft.com/en-us/download/details.aspx?id=49502" target="_blank">here</a>.

For those who attended the session, do share your valuable feedback in the comments section of this blog and rate my session <a href="http://spkr8.com/t/67981">here</a>.

For the upcoming webinars you can visit the <a href="https://www.facebook.com/groups/1537669073140700/" target="_blank">Facebook page</a> or <a href="http://sqldelhi.sqlpass.org/Home.aspx" target="_blank">SQL Server PASS Community page</a>.]]></content:encoded>
    </item>
    <item>
      <title>Fixing orphaned Windows user logins in SQL Server</title>
      <link>https://docs.microsoft.com/archive/blogs/techreflections/fixing-orphaned-windows-user-logins-in-sql-server</link>
      <pubDate>Fri, 25 Dec 2015 11:26:00 GMT</pubDate>
      <dc:creator><![CDATA[Devashish_Salgaonkar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/techreflections/2015/12/25/fixing-orphaned-windows-user-logins-in-sql-server/</guid>
      <description><![CDATA[This is going to be a short blog post on a scenario which I encountered recently. Although there is...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: Calibri; font-size: small;">This is going to be a short blog post on a scenario which I encountered recently. Although there is MSDN documentation around this but I did not find anything which explicitly called out the scenario I had encountered, hence penning this down.</span></p>
<p><span style="font-family: Calibri; font-size: small;">Most SQL DBA's are aware of the stored procedure &ndash; </span><span style="color: #0563c1; font-family: Calibri; font-size: small;"><a href="https://msdn.microsoft.com/en-us/library/ms174378.aspx" target="_blank">sp_change_users_login</a></span><span style="font-family: Calibri; font-size: small;"> which is generally used to report and fix orphaned </span><strong><span style="font-family: Calibri; font-size: small;">SQL SERVER LOGIN&rsquo;s. </span></strong><span style="font-family: Calibri; font-size: small;">I am explicitly mentioning this since the </span><span style="font-family: Calibri; font-size: small;">stored procedure cannot be used for </span><strong><span style="font-family: Calibri; font-size: small;">Windows Logins</span></strong><span style="font-family: Calibri; font-size: small;">. This has been explicitly pointed out in </span><span style="text-decoration: underline;"><span style="color: #0563c1; font-family: Calibri; font-size: small; text-decoration: underline;"><a href="https://msdn.microsoft.com/en-us/library/ms174378.aspx" target="_blank">books online</a></span></span><span style="font-family: Calibri; font-size: small;"> &ndash; </span></p>
<p><em><span style="font-family: Calibri; font-size: small;">sp_change_users_login</span></em><em><span style="font-family: Calibri; font-size: small;"> cannot be used to map database users to Windows-level principals, certificates, or asymmetric keys.</span></em></p>
<p>&nbsp;</p>
<p><span style="font-family: Calibri; font-size: small;">If you still want to experiment -</span></p>
<p><span style="font-size: medium;">EXEC sp_change_users_login 'Update_One', 'TestUser', 'Testdomain\TestUser';</span></p>
<p><span style="font-size: medium;">GO</span></p>
<p><span style="font-family: Calibri; font-size: small;">Then you will encounter the below error &ndash; </span></p>
<p><span style="color: #ff0000;">Msg 15291, Level 16, State 1, Procedure sp_change_users_login, Line 114</span></p>
<p><span style="color: #ff0000;">Terminating this procedure. The User name 'TestUser' is absent or invalid.</span></p>
<p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></p>
<p><span style="font-family: Calibri; font-size: small;">So what do you do when you want to fix orphaned Windows users.</span></p>
<p><span style="font-family: Calibri; font-size: small;">In such case you can use </span><span style="font-size: medium;">alter user [user_name] with login = [login_name] </span><span style="font-family: Calibri; font-size: small;">to fix orphaned windows login.&nbsp;</span><span style="font-family: Calibri; font-size: small;">This command </span><span style="font-family: Calibri; font-size: small;">re-maps a user to another login by changing the user's Security Identifier (SID) to match the login's SID.</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Calibri; font-size: small;">Additionally, while researching on this topic I also found that sp_change_users_login is deprecated.&nbsp; </span></p>
<p><span style="font-family: Calibri; font-size: small;">From </span><a href="https://msdn.microsoft.com/en-us/library/ms174378.aspx"><span style="color: #0563c1; font-family: Calibri; font-size: small;">books online</span></a><span style="font-family: Calibri; font-size: small;"> again - This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use </span><a href="https://msdn.microsoft.com/en-us/library/ms176060.aspx"><span style="color: #0563c1; font-family: Calibri; font-size: small;">ALTER USER</span></a><span style="font-family: Calibri; font-size: small;"> instead.</span></p>
<p>Hence you can now use ALTER USER command for all type of users.</p>
<p>&nbsp;</p>
<p><span style="font-family: Calibri; font-size: small;">Incase you are interested in finding out orphaned Windows Users, you can use the below query &ndash; </span></p>
<p><span style="font-size: medium;">SELECT NAME,SID FROM SYS.DATABASE_PRINCIPALS</span></p>
<p><span style="font-size: medium;">WHERE</span></p>
<p><span style="font-size: medium;">TYPE = 'U' --Users only</span></p>
<p><span style="font-size: medium;">AND AUTHENTICATION_TYPE = 3 --Windows Logins only</span></p>
<p><span style="font-size: medium;">AND NAME NOT LIKE 'DBO'</span></p>
<p><span style="font-size: medium;">EXCEPT</span></p>
<p><span style="font-size: medium;">(SELECT DP.NAME, DP.SID FROM SYS.DATABASE_PRINCIPALS DP</span></p>
<p><span style="font-size: medium;">INNER JOIN SYS.SERVER_PRINCIPALS SP ON DP.SID = SP.SID&nbsp;</span></p>
<p><span style="font-size: medium;">WHERE DP.TYPE = 'U'</span></p>
<p><span style="font-size: medium;">AND DP.AUTHENTICATION_TYPE = 3)</span></p>
<p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></p>
<p><span style="font-family: Calibri; font-size: small;">Hope this helps you in case you are stuck with these orphaned users! Do send in your comments/thoughts.</span></p>
<p><span>Disclaimer: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Inappropriate comments will be deleted at the authors discretion. All code samples are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular.</span></p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Powershell Script to get the last SQL Server restart Time</title>
      <link>https://docs.microsoft.com/archive/blogs/techreflections/powershell-script-to-get-the-last-sql-server-restart-time</link>
      <pubDate>Thu, 24 Dec 2015 23:31:00 GMT</pubDate>
      <dc:creator><![CDATA[Devashish_Salgaonkar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/techreflections/2015/12/24/powershell-script-to-get-the-last-sql-server-restart-time/</guid>
      <description><![CDATA[I wrote this powershell script to find out the last SQL Server Restart times from a batch of servers...]]></description>
      <content:encoded><![CDATA[<span style="font-family: Calibri;font-size: small">I wrote this powershell script to find out the last SQL Server Restart times from a batch of servers in an excel sheet and output the results in an excel. The script also takes care of unreachable servers and prints a message that it could not be connected.</span>

<span style="font-family: Calibri;font-size: small">Although this is a simple script, the idea behind this can extended further to fetch similar information from SQL Server as required.</span>

<strong><span style="font-family: Calibri;font-size: small">Usage -</span></strong>

<span style="font-family: Calibri;font-size: small">The script picks up the list of servers from an excel sheet and outputs the results on the console along with an excel sheet. Progress messages are also displayed.</span>

<span style="font-family: Calibri;font-size: small">The script takes the below 4 parameters as described below</span>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="137"><span style="font-family: Calibri;font-size: small">Parameter</span></td>
<td valign="top" width="138"><span style="font-family: Calibri;font-size: small">Defaults</span></td>
<td valign="top" width="503"><span style="font-family: Calibri;font-size: small">Description</span></td>
</tr>
<tr>
<td valign="top" width="137"><span style="font-family: Calibri;font-size: small">-InputFilePath</span></td>
<td valign="top" width="138"><span style="font-family: Calibri;font-size: small">Mandatory, No defaults</span></td>
<td valign="top" width="503"><span style="font-family: Calibri;font-size: small">Provide the complete path on the drive of the excel sheet. Prerequisite for the input file is to have the first row of the excel as the column header.</span></td>
</tr>
<tr>
<td valign="top" width="137"><span style="font-family: Calibri;font-size: small">-Sheet</span></td>
<td valign="top" width="138"><span style="font-family: Calibri;font-size: small">Default = ‘Sheet1’</span></td>
<td valign="top" width="503"><span style="font-family: Calibri;font-size: small">Provide the name of the sheet where the server details are located. If not specified, the default value "Sheet1" will be considered.</span></td>
</tr>
<tr>
<td valign="top" width="137"><span style="font-family: Calibri;font-size: small">-Columnnumber</span></td>
<td valign="top" width="138"><span style="font-family: Calibri;font-size: small">Default=1</span></td>
<td valign="top" width="503"><span style="font-family: Calibri;font-size: small">Provide the column number in the excel sheet where the server names are specified.</span></td>
</tr>
<tr>
<td valign="top" width="137"><span style="font-family: Calibri;font-size: small">-OutputFilePath</span></td>
<td valign="top" width="138"><span style="font-family: Calibri;font-size: small">Mandatory, No defaults</span></td>
<td valign="top" width="503"><span style="font-family: Calibri;font-size: small">Provide the folder path where the output CSV file needs to be saved. Hardcoded filename will be outputServerDetails.csv.</span></td>
</tr>
</tbody>
</table>
&nbsp;

<strong><span style="font-family: Calibri;font-size: small">Sample output</span></strong>

<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/0602.SampleOutput.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/0602.SampleOutput.jpg" alt="" border="0" /></a>

&nbsp;

<span style="font-family: Calibri;font-size: small">Also thanks to my colleague </span><a href="http://sqluninterrupted.com/"><span style="color: #0563c1;font-family: Calibri;font-size: small">Sourabh Agarwal</span></a><span style="font-family: Calibri;font-size: small"> (<a href="http://sqluninterrupted.com/">b</a>|<a href="https://twitter.com/SQLSourabh">t</a>) - Microsoft Premier Field engineer for helping me with ideas while building this script.</span>

The script is attached to this blog post. Please do share your comments/views/ideas on this script.

<a href="https://msdnshared.blob.core.windows.net/media/2016/07/LastRestartTime_SQLServer.zip" rel="">LastRestartTime_SQLServer</a>]]></content:encoded>
    </item>
    <item>
      <title>Login Failure with Pass-Through Authentication</title>
      <link>https://docs.microsoft.com/archive/blogs/techreflections/login-failure-with-pass-through-authentication</link>
      <pubDate>Thu, 16 Jul 2015 11:13:00 GMT</pubDate>
      <dc:creator><![CDATA[Devashish_Salgaonkar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/techreflections/2015/07/16/login-failure-with-pass-through-authentication/</guid>
      <description><![CDATA[Although SQL Server login failure issues are pretty common I did not find this one documented...]]></description>
      <content:encoded><![CDATA[<p>Although SQL Server login failure issues are pretty common I did not find this one documented anywhere, hence this blog post.</p>
<p>Recently I stumbled upon a Login failure error while connecting to an SQL Instance remotely. The authentication scheme used in this case was <strong>Pass-through Authentication</strong>.</p>
<p>For those who are not aware of Pass-through authentication, it&rsquo;s basically a technique in which a local windows user account is created on the source and destination server with the same password. If the user account has the same username and password, Windows authenticates this user and lets him access the resources. This scheme is generally used where there is prohibition of domain account.</p>
<p>So here&rsquo;s the error which I got while connecting via SSMS &ndash;</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="1247">
<p><em>TITLE: Connect to Server</em></p>
<p><em>------------------------------</em></p>
<p><em>Cannot connect to WIN2K12NODE1.</em></p>
<p><em>------------------------------</em></p>
<p><em>ADDITIONAL INFORMATION:</em></p>
<p><strong><em>Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.</em></strong><em> (Microsoft SQL Server, Error: 18452)</em></p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>Looking at the errorlog revealed the below errors &ndash;&nbsp;</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="1247">
<p><em>2015-07-15 21:26:50.06 Logon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Error: 17806, Severity: 20, State: 14.</em></p>
<p><em>2015-07-15 21:26:50.06 Logon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SSPI handshake failed with error code <span style="background-color: #00ff00;"><strong>0x8009030c</strong></span>, state 14 while establishing a connection with integrated security; the connection has been closed. Reason: AcceptSecurityContext failed. The Windows error code indicates the cause of failure. The logon attempt failed&nbsp;&nbsp; [CLIENT: 10.10.10.2]</em></p>
<p><em>2015-07-15 21:26:50.08 Logon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Error: 18452, Severity: 14, State: 1.</em></p>
<p><em>2015-07-15 21:26:50.08 Logon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. [CLIENT: 10.10.10.2]</em></p>
</td>
</tr>
</tbody>
</table>
<p>SSPI Handshake Failed errors happens usually when the user is not authenticated.&nbsp;Let&rsquo;s see what the specific error code means. For this I generally use the command line utility <a href="http://www.microsoft.com/en-us/download/details.aspx?id=985">Err.exe</a> which is one of the must haves for an administrator.</p>
<p>Here is what I got &ndash;&nbsp;</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="1247">
<p><em>E:\Tools\Err&gt;Err.EXE <strong><span style="background-color: #00ff00;">0x8009030c</span></strong></em></p>
<p><em># for hex 0x8009030c / decimal -2146893044 :</em></p>
<p><em>&nbsp; SEC_E_LOGON_DENIED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; winerror.h</em></p>
<p><em># The logon attempt failed</em></p>
<p><em># 1 matches found for "0x8009030c"</em></p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>In this case the output was not very helpful.&nbsp;</p>
<p>Next I looked at the security event logs and found this Audit failure&ndash;&nbsp;</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="1247">
<p><em>Log Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Security</em></p>
<p><em>Source:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Microsoft-Windows-Security-Auditing</em></p>
<p><em>Event ID:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4625</em></p>
<p><em>Task Category: Logon</em></p>
<p><em>Level:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Information</em></p>
<p><em>Keywords:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Audit Failure</em></p>
<p><em>User:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; N/A</em></p>
<p><em>Computer:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Win2K12Node1.icicibank.com</em></p>
<p><em>Description:</em></p>
<p><span style="background-color: #ffff00;"><em>An account failed to log on.</em></span></p>
<p><em>&nbsp;</em></p>
<p><em>Subject:</em></p>
<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Security ID:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL SID</em></p>
<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Account Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -</em></p>
<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Account Domain:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -</em></p>
<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Logon ID:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x0</em></p>
<p><em>&nbsp;</em></p>
<p><em>Logon Type:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3</em></p>
<p><em>&nbsp;</em><em>Account For Which Logon Failed:</em></p>
<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Security ID:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL SID</em></p>
<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Account Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TestUser</em></p>
<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Account Domain:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WIN2K12NODE2</em></p>
<p><em>&nbsp;</em><em>Failure Information:</em></p>
<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Failure Reason:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="background-color: #ffff00;">Unknown user name or bad password.</span></em></p>
<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Status:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xC000006D</em></p>
<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sub Status:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xC000006A</em></p>
</td>
</tr>
</tbody>
</table>
<p>In this case, it could not be unknown Username since the account existed in SQL Server. But yeah, it could be a Bad password. And that it was, <strong>resetting the password on the machine from where I was connecting to SQL Server did the trick for me.</strong>&nbsp;</p>
<p><strong><span style="text-decoration: underline;">Learnings </span></strong></p>
<p>Password mismatch for the local windows account between the servers. For pass-through authentication to work it&rsquo;s important that we have the same username and password.</p>
<p>Even though there is a mismatch in the password we do not get 18456 (Login failed due to password mismatch) because the authentication scheme is slightly different in this case. The username and passwords are itself used to match the login in pass-through authentication.</p>
<p>&nbsp;</p>
<p>Disclaimer: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Inappropriate comments will be deleted at the author&rsquo;s discretion. All code samples are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular.</p>]]></content:encoded>
    </item>
    <item>
      <title>Certificates not visible in Server Certificates console of IIS 7/IIS 8 Manager</title>
      <link>https://docs.microsoft.com/archive/blogs/techreflections/certificates-not-visible-in-server-certificates-console-of-iis-7iis-8-manager</link>
      <pubDate>Sat, 04 Jul 2015 10:29:00 GMT</pubDate>
      <dc:creator><![CDATA[Devashish_Salgaonkar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/techreflections/2015/07/04/certificates-not-visible-in-server-certificates-console-of-iis-7iis-8-manager/</guid>
      <description><![CDATA[You are planning to deploy SSL certificate for your website. You go ahead and get the required...]]></description>
      <content:encoded><![CDATA[<p>You are planning to <a href="http://www.iis.net/learn/manage/configuring-security/how-to-set-up-ssl-on-iis" target="_blank">deploy</a> SSL certificate for your website. You go ahead and get the required certificates from the Certificate Authority (CA) and install it in the <strong>Local Machine store</strong> via Certificate Manager.</p>
<p>Next, you go to <strong>Server Certificate feature</strong> to check for the installed certificate before you can bind the certificate with the website.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/4532.Img1-ServerCertificateConsole.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/4532.Img1_2D00_ServerCertificateConsole.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/4532.Img1-ServerCertificateConsole.jpg" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/4532.Img1_2D00_ServerCertificateConsole.jpg" alt="" width="144" height="100" /></a></p>
<p>But the Certificate you just installed is not showing in the console, its missing! What do you do?</p>
<p>You verify the certificate is valid by checking the following -</p>
<ol>
<li>That the current date and time is within the "Valid from" and "Valid to" date range on the certificate.</li>
<li>That the certificate's "Common Name" (CN) matches the host header in the request. For example, if the client is making a request to http://www.contoso.com/, then the CN must also be http://www.contoso.com/.</li>
<li>That the issuer of the certificate is a known and trusted CA</li>
</ol>
<p>All the above conditions are true but still the certificate is not showing up.</p>
<p>It happens that the Server Certificates module in IIS manager displays a list of certificates from the Local Machine SSL store. But it only lists the certificate if -&nbsp;</p>
<p><strong>1. The certificate has a private key</strong></p>
<p><strong>2. The certificate is meant for Server Authentication</strong></p>
<p>In my case I found that the<strong> private key was missing</strong> in the certificate.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/6330.Img2-MissingPvtKey.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/6330.Img2_2D00_MissingPvtKey.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/6330.Img2-MissingPvtKey.jpg" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/6330.Img2_2D00_MissingPvtKey.jpg" alt="" width="321" height="300" /></a></p>
<p>We can recover the private key by following the below steps &ndash;</p>
<p>To recover the private key on the certificate, we need to repair the certificate using the following command &ndash;</p>
<p><em><strong>certutil &ndash;repairstore my</strong></em><strong><em>&nbsp;</em></strong><em>&lt;serial number&gt;</em></p>
<p>where serial number can be obtained by looking up the certificate properties as indicated below.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/8154.Img3-SerialNumber.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/8154.Img3_2D00_SerialNumber.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/8154.Img3-SerialNumber.jpg" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/8154.Img3_2D00_SerialNumber.jpg" alt="" width="406" height="300" /></a></p>
<p>Once the certificate was repaired, we were able to get back the private key.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/2313.Img4-CertwithPvtKey.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/2313.Img4_2D00_CertwithPvtKey.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/2313.Img4-CertwithPvtKey.jpg" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/2313.Img4_2D00_CertwithPvtKey.jpg" alt="" width="321" height="300" /></a></p>
<p>If the above commands completes successfully but does not work to get back the private key then you may have to recreate the certificate.</p>
<p>Once my private key was retrieved, the Server Certificates console starting showing up the certificate as well.</p>
<p><span style="text-decoration: underline;">References</span></p>
<p>Certutil - <a href="https://technet.microsoft.com/en-us/library/cc732443.aspx">https://technet.microsoft.com/en-us/library/cc732443.aspx</a></p>
<p><a href="http://blogs.msdn.com/b/jaskis/archive/2009/04/22/missing-private-keys-pair-after-deleting-pending-request-from-iis.aspx">http://blogs.msdn.com/b/jaskis/archive/2009/04/22/missing-private-keys-pair-after-deleting-pending-request-from-iis.aspx</a></p>
<p>Disclaimer: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Inappropriate comments will be deleted at the author&rsquo;s discretion. All code samples are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular.</p>]]></content:encoded>
    </item>
    <item>
      <title>Troubleshooting Null Reference Exceptions in live ASP.NET applications</title>
      <link>https://docs.microsoft.com/archive/blogs/techreflections/troubleshooting-null-reference-exceptions-in-live-asp-net-applications</link>
      <pubDate>Sun, 31 May 2015 04:07:00 GMT</pubDate>
      <dc:creator><![CDATA[Devashish_Salgaonkar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/techreflections/2015/05/31/troubleshooting-null-reference-exceptions-in-live-asp-net-applications/</guid>
      <description><![CDATA[This post is more developer centric than for administrators but as the industry moves towards DevOps...]]></description>
      <content:encoded><![CDATA[<p>This post is more developer centric than for administrators but as the industry moves towards DevOps both worlds are merging and is becoming seamless hence the information in this blog could be helpful to both sides.</p>
<p>In my day to day work, I do a lot of troubleshooting on the IIS Admin side but while delving into the scheme of things I realized that more often than not the issues lie in application code.</p>
<p>Most developers are able to troubleshoot code issues on their development boxes. But what if the issue is only happening on production servers and not on development machines. This will need live debugging, which is the idea behind this blog post.</p>
<p>&nbsp;</p>
<p>For the purpose of this blog, I have created a Sample application which generates a Null pointer reference exception. But the debugging method can be used to troubleshoot any type of exception.</p>
<p>Here is the snip of the login form -</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/8540.Img1.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/8540.Img1.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/8540.Img1.jpg" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/8540.Img1.jpg" alt="" border="0" /></a></p>
<p>Once I click on the Submit button I get the below Server Error -</p>
<p>Note - This type of detailed errors will generally be seen when you are browsing the web page locally on the web server and not on remote clients (default settings). To change this you can follow - https://technet.microsoft.com/en-us/library/bb684665.aspx.</p>
<p>&nbsp;&nbsp;</p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/4403.Img2.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/4403.Img2.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/4403.Img2.jpg" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/4403.Img2.jpg" alt="" border="0" /></a></p>
<p>At the same time, you would generally see an event in the application system event log &ndash;</p>
<p>&lt;snip&gt;&nbsp;</p>
<p>Event code: 3005</p>
<p>Event message: An unhandled exception has occurred.</p>
<p>Application information:</p>
<p>&nbsp;&nbsp;&nbsp; Application domain: /LM/W3SVC/4/ROOT-1-130775233748599802</p>
<p>&nbsp;&nbsp;&nbsp; Trust level: Full</p>
<p>&nbsp;&nbsp;&nbsp; Application Virtual Path: /</p>
<p>&nbsp;&nbsp;&nbsp; Application Path: E:\SampleWebApp1\</p>
<p>&nbsp;&nbsp;&nbsp; Machine name: <span style="background-color: #000000;">DESALG-LAPTOP</span></p>
<p>&nbsp;</p>
<p>Process information:</p>
<p>&nbsp;&nbsp;&nbsp; Process ID: 18744</p>
<p>&nbsp;&nbsp;&nbsp; Process name: w3wp.exe</p>
<p>&nbsp;&nbsp;&nbsp; Account name: IIS APPPOOL\SampleWebApp1</p>
<p>&nbsp;</p>
<p>Exception information:</p>
<p>&nbsp;&nbsp;&nbsp; Exception type: NullReferenceException</p>
<p>&nbsp;&nbsp;&nbsp; Exception message: Object reference not set to an instance of an object.</p>
<p>&nbsp;&nbsp; at SampleWebApp1.WebForm1.Button1_Click(Object sender, EventArgs e)</p>
<p>&nbsp;&nbsp; at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)</p>
<p>&nbsp;&nbsp; at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)</p>
<p>&nbsp;</p>
<p>Request information:</p>
<p>&nbsp;&nbsp;&nbsp; Request URL: http://localhost:8080/WebForm1.aspx</p>
<p>&nbsp;&nbsp;&nbsp; Request path: /WebForm1.aspx</p>
<p>&nbsp;&nbsp;&nbsp; User host address: ::1</p>
<p>&nbsp;&nbsp;&nbsp; User: <span style="background-color: #000000;">FAREAST\desalg</span></p>
<p>&nbsp;&nbsp;&nbsp; Is authenticated: True</p>
<p>&nbsp;&nbsp;&nbsp; Authentication Type: Negotiate</p>
<p>&nbsp;&nbsp;&nbsp; Thread account name: IIS APPPOOL\SampleWebApp1</p>
<p>&lt;snip&gt;&nbsp;</p>
<p>&nbsp;</p>
<p>From the stack trace, you can see that it tells us the function (SampleWebApp1.WebForm1.Button1_Click) in which the exception occurred but it does not tell us the line of code where the exception occurred.</p>
<p>Assuming this code is deployed on the web server, here is a way how you can debug this live using windbg.</p>
<p>You can download and install WinDBG from here - <a href="https://msdn.microsoft.com/en-us/windows/hardware/hh852365">https://msdn.microsoft.com/en-us/windows/hardware/hh852365</a></p>
<p>&nbsp;</p>
<p>Note &ndash; You can follow the link <a href="https://msdn.microsoft.com/en-us/library/dd465337(v=vs.110).aspx">https://msdn.microsoft.com/en-us/library/dd465337(v=vs.110).aspx</a> to deploy the attached project to this blog on the web server.</p>
<p>If you deployed this with the default settings then hitting the link - <a href="http://localhost:8080/WebForm1.aspx">http://localhost:8080/WebForm1.aspx</a> would open the web page and trigger the worker process on the server.</p>
<p>&nbsp;</p>
<p>Step 1 &ndash; Setup the Source File path (Location of the application source files) &ndash; File &gt; Source File Path &hellip;</p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/2664.Img3.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/2664.Img3.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/2664.Img3.jpg" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/2664.Img3.jpg" alt="" border="0" /></a></p>
<p>Step 2 - Setup the Symbol File path (Location of the application pdb files) &ndash; File &gt; Symbol File Path &hellip;</p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/2577.Img4.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/2577.Img4.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/2577.Img4.jpg" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/2577.Img4.jpg" alt="" border="0" /></a></p>
<p>Step 3 &ndash; File &gt; Attach to the process &ndash; Select the worker process</p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/6283.Img5.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/6283.Img5.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/6283.Img5.jpg" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/6283.Img5.jpg" alt="" border="0" /></a></p>
<p>&nbsp;</p>
<p>Once you click &lsquo;Ok&rsquo;, the worker process will get attached to WinDBG and the control will be with debugger.</p>
<p>Step 4 &ndash; Run the below command to load the appropriate version of SOS.dll in WinDBG which is required for the purpose of debugging.</p>
<p>0:035&gt; .cordll -ve -u -l</p>
<p>Automatically loaded SOS Extension</p>
<p>CLRDLL: Loaded DLL C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscordacwks.dll</p>
<p>CLR DLL status: Loaded DLL C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscordacwks.dll</p>
<p>*** WARNING: Unable to verify checksum for SampleWebApp1.dll</p>
<p>&nbsp;</p>
<p>0:035&gt; .Chain <span style="color: #339966;">&ndash;Gives the extensions loadedby windbg</span></p>
<p>&lt;snipped&gt;</p>
<p>Extension DLL chain:</p>
<p><span style="background-color: #ffff00;">&nbsp;&nbsp;&nbsp; C:\Windows\Microsoft.NET\Framework64\v4.0.30319\sos: image 4.0.30319.34209, API 1.0.0, built Sat Apr 12 07:33:15 2014</span></p>
<p><span style="background-color: #ffff00;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\SOS.dll]</span></p>
<p>&lt;snipped&gt;</p>
<p>&nbsp;</p>
<p>Step 5 &ndash; Type &lsquo;g&rsquo; in the command line of WinDBG to pass the control back to the application.</p>
<p>Step 6 &ndash; Fill in the login form and Click on Submit to generate the exception. The control will be sent back to WinDBG when the exception is hit.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/5226.Img6.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/5226.Img6.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/5226.Img6.jpg" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/5226.Img6.jpg" alt="" border="0" /></a>&nbsp;</p>
<p><em>0:035&gt; g</em></p>
<p><em>(4910.4a7c): CLR exception - code e0434352 (first chance)</em></p>
<p><em>CLR exception type: System.Web.HttpUnhandledException</em></p>
<p><em>&nbsp;&nbsp;&nbsp; ""</em></p>
<p><em>(4910.1dd4): <span style="background-color: #ffff00;">Access violation - code c0000005 (first chance)</span></em></p>
<p><em>First chance exceptions are reported before any exception handling.</em></p>
<p><em>This exception may be expected and handled.</em></p>
<p><em>SampleWebApp1!SampleWebApp1.WebForm1.Button1_Click(System.Object, System.EventArgs)+0x8:</em></p>
<p><em>00007ff7`c71318e8 8b00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp;&nbsp;&nbsp; eax,dword ptr [rax] ds:00000000`00000008=????????</em></p>
<p>&nbsp;</p>
<p>If your source code alignment is properly done, windbg does a pretty neat job of highlighting the line of code that has caused the exception. This should be good enough information for the developer of the code to take forward the debugging.</p>
<p>For advanced folks, little bit more debugging and you can pull more details about the exception like the call stack and the type of exception.</p>
<p>&nbsp;</p>
<p>0:040&gt; !clrstack&nbsp;<span style="color: #339966;"> -- Gives the callstack of the thread which threw the exception</span></p>
<p>&nbsp;</p>
<p><span style="background-color: #ffff00;">SampleWebApp1.WebForm1.Button1_Click(System.Object, System.EventArgs)</span></p>
<p>System.Web.UI.WebControls.Button.RaisePostBackEvent(System.String)</p>
<p>System.Web.UI.Page.ProcessRequestMain(Boolean, Boolean)</p>
<p>System.Web.UI.Page.ProcessRequest(Boolean, Boolean)</p>
<p>System.Web.UI.Page.ProcessRequest()</p>
<p>System.Web.UI.Page.ProcessRequest(System.Web.HttpContext)</p>
<p>System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()</p>
<p>System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef)</p>
<p>System.Web.HttpApplication+PipelineStepManager.ResumeSteps(System.Exception)</p>
<p>System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext, System.AsyncCallback)</p>
<p>System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest, System.Web.HttpContext)</p>
<p>System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)</p>
<p>System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)</p>
<p>DomainNeutralILStubClass.IL_STUB_ReversePInvoke(Int64, Int64, Int64, Int32)</p>
<p>[InlinedCallFrame: 0000003e724eeac8] System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, System.Web.RequestNotificationStatus ByRef)</p>
<p>[InlinedCallFrame: 0000003e724eeac8] System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, System.Web.RequestNotificationStatus ByRef)</p>
<p>DomainNeutralILStubClass.IL_STUB_PInvoke(IntPtr, System.Web.RequestNotificationStatus ByRef)</p>
<p>System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)</p>
<p>System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)</p>
<p>DomainNeutralILStubClass.IL_STUB_ReversePInvoke(Int64, Int64, Int64, Int32)</p>
<p>[ContextTransitionFrame: 0000003e724eefc8]</p>
<p>&nbsp;</p>
<p>0:040&gt; t <span style="color: #339966;">&ndash;Step into the code</span></p>
<p>(4910.1dd4): Access violation - code c0000005 (first chance)</p>
<p>First chance exceptions are reported before any exception handling.</p>
<p>This exception may be expected and handled.</p>
<p>KERNELBASE!RaiseException+0x6c:</p>
<p>00007ff8`337f8b9c 488b8c24c0000000 mov&nbsp;&nbsp;&nbsp;&nbsp; rcx,qword ptr [rsp+0C0h] ss:0000003e`724ed450=0000ed06eea53973</p>
<p>&nbsp;</p>
<p>0:040&gt; t</p>
<p>(4910.1dd4): CLR exception - code e0434352 (first chance)</p>
<p>clr!IEE+0x71a7:</p>
<p>00007ff8`268a9c03 483b4728&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmp&nbsp;&nbsp;&nbsp;&nbsp; rax,qword ptr [rdi+28h] ds:00007ff8`096b77d8=00000000000cb27b</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>0:040&gt; !pe<span style="color: #339966;"> &ndash;Prints exception on the callstack and will work if the SOS dll is loaded</span></p>
<p>Exception object: 0000003ca7048cb8</p>
<p>Exception type:&nbsp;&nbsp; System.Web.HttpUnhandledException</p>
<p>Message:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;none&gt;</p>
<p>InnerException:&nbsp;&nbsp; System.NullReferenceException, Use !PrintException 0000003ca7048990 to see more.</p>
<p>StackTrace (generated):</p>
<p>&lt;none&gt;</p>
<p>StackTraceString: &lt;none&gt;</p>
<p>HResult: 80004005</p>
<p>There are nested exceptions on this thread. Run with -nested for details</p>
<p>&nbsp;</p>
<p>References -&nbsp;<a href="http://blogs.msdn.com/b/kaevans/archive/2011/04/11/intro-to-windbg-for-net-developers.aspx">http://blogs.msdn.com/b/kaevans/archive/2011/04/11/intro-to-windbg-for-net-developers.aspx</a></p>
<p>&nbsp;</p>
<p>Disclaimer: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Inappropriate comments will be deleted at the authors discretion. All code samples are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular.</p>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/61/83/90/SampleWebApp1.7z" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-61-83-90/SampleWebApp1.7z">SampleWebApp1.7z</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Case of Transaction Log backups not getting restored</title>
      <link>https://docs.microsoft.com/archive/blogs/techreflections/case-of-transaction-log-backups-not-getting-restored</link>
      <pubDate>Sat, 23 May 2015 11:13:27 GMT</pubDate>
      <dc:creator><![CDATA[Devashish_Salgaonkar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/techreflections/2015/05/23/case-of-transaction-log-backups-not-getting-restored/</guid>
      <description><![CDATA[I got a call from a DBA late night waking me up from deep slumber. They were restoring a critical...]]></description>
      <content:encoded><![CDATA[<p>I got a call from a DBA late night waking me up from deep slumber. They were restoring a critical database from backup and were getting the below error -</p>
<p>&nbsp;</p>
<p><em>Msg 3013, Level 16, State 1, Line 2</em></p>
<p><em>RESTORE LOG is terminating abnormally.</em></p>
<p><em>Msg 3441, Level 17, State 1, Line 2</em></p>
<p><em>During startup of warm standby database 'TestDB' (database ID 5), its standby file</em></p>
<p><em>&nbsp;('<span style="background-color: #ffff00;">Q:\mssql\backup\TestDB\TestDB_20150419043800.trn</span>') was inaccessible to the RESTORE statement.</em></p>
<p><em>The operating system error was '32(The process cannot access the file because it is being used by another process.)'.</em></p>
<p><em>Diagnose the operating system error, correct the problem, and retry startup.</em></p>
<p>&nbsp;</p>
<p>If you look carefully at the error message &ndash; its saying that the standby file which it is looking for is <span style="background-color: #ffff00;">&ldquo;TestDB_20150419043800.trn&rdquo;</span>.</p>
<p>Strange!...This is the same backup file we are trying to restore using the below command -</p>
<p><em>restore log TestDB from disk = 'Q:\mssql\backup\TestDB\TestDB _20150419043800.trn' with recovery</em></p>
<p>How can this happen?</p>
<p>&nbsp;</p>
<p>I suspected that this could be a problem with the restoration command used to put the database in standby. I asked the DBA, if he had the command which was used to put the database in standby mode. Unfortunately, the answer was a No. How could I confirm.</p>
<p>Ok, no problem. I asked him to send me the Default traces since I knew we track restore statements in the default trace file.</p>
<p>Hoping to find something useful, I opened the default trace and guess what I found &ndash;</p>
<p>&nbsp;</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="1247">
<p>Audit Backup/Restore Event&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
</td>
</tr>
<tr>
<td valign="top" width="1247">
<p>Microsoft SQL Server Management Studio - Query&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
</td>
</tr>
<tr>
<td valign="top" width="1247">
<p>2 - Restore&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
</td>
</tr>
<tr>
<td valign="top" width="1247">
<p><span style="background-color: #ffff00;">restore log TestDB from disk = '<strong>Q:\mssql\backup\TestDB\TestDB_<span style="color: #ff0000;">20150419043800</span>.trn</strong>' with standby = '<strong>Q:\mssql\backup\TestDB\TestDB_<span style="color: #ff0000;">20150419043800</span>.trn</strong>'</span></p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>Looks like the DBA had restored the previous transaction log file with standby but by mistake specified the same transaction log backup file in the standby clause. It did not give an error but effectively what happened was that the .trn file was having the standby information.</p>
<p>Thinking that there was some corruption with the transaction log backup file, he had gone ahead and replaced the log backup file (which now had the standby information) with the original transaction log backup file. By doing so, we lost the standby information and we could not restore further backups nor recover the database since it was looking for the standby file which was no longer present.</p>
<p>In this case, the only option to get out of this situation was to restore the database from Full backup and apply the log backups.</p>
<p>&nbsp;</p>
<p style="text-align: center;">Moral of the story &ndash; Database restore sequences are very sensitive, be very careful.</p>
<p><span>Disclaimer: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Inappropriate comments will be deleted at the authors discretion. All code samples are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular.</span></p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Files not getting uploaded using Web service</title>
      <link>https://docs.microsoft.com/archive/blogs/techreflections/files-not-getting-uploaded-using-web-service</link>
      <pubDate>Sat, 16 May 2015 10:21:00 GMT</pubDate>
      <dc:creator><![CDATA[Devashish_Salgaonkar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/techreflections/2015/05/16/files-not-getting-uploaded-using-web-service/</guid>
      <description><![CDATA[The other day, a web application developer contacted me and said that he was not able to upload...]]></description>
      <content:encoded><![CDATA[<p>The other day, a web application developer contacted me and said that he was not able to upload files to the web server. He was using a web service to have the files uploaded to the application server and he was getting the below error &ndash;</p>
<p><em>The HTTP request was forbidden with client authentication scheme 'Anonymous'.</em></p>
<p>He had done his homework before coming to me and said that he was able to upload files of smaller size but when he would try larger files (around 40-50 MB) he was getting the above error. This meant that at least the upload module was working fine.</p>
<p>I asked the developer to reproduce the issue and I looked at the IIS logs generated for the website.</p>
<p>Here&rsquo;s what I found &ndash;</p>
<p>GET /<span style="background-color: #ffff00;">Rejected-By-UrlScan</span> ~/TestService/TestProtocolService.svc 88 - ::1 - - 404 0 2 100</p>
<p>GET /<span style="background-color: #ffff00;">Rejected-By-UrlScan</span> ~/TestService/TestProtocolService.svc 88 - ::1 - - 404 0 2 1</p>
<p>Oh, looks like there is a <strong>URLSCAN</strong> module installed on IIS which is rejecting the requests.</p>
<p>&nbsp;</p>
<p><em>For those who are not aware of <a title="URLSCAN" href="http://www.iis.net/downloads/microsoft/urlscan" target="_blank">URLSCAN</a> &ndash; It is basically security extension that restricts the types of HTTP requests that IIS will process. By blocking specific HTTP requests, the UrlScan helps to prevent potentially harmful requests from reaching applications on the server.&nbsp;This was used in older versions but newer versions (IIS 7 and above) has a new feature called as <a title="Request Filtering" href="https://technet.microsoft.com/en-us/library/cc754791" target="_blank">Request Filtering</a>.</em></p>
<p>&nbsp;</p>
<p>But why are these requests getting rejected, these seem to be legitimate requests.</p>
<p>I looked into the URLSCAN logs (Default Location - C:\Windows\System32\inetsrv\urlscan\logs) to understand the reason -</p>
<p>POST /TestService/TestProtocolService.svc Rejected <span style="background-color: #ffff00;">Content+length+too+long Content-Length</span>: 89437188 30000000</p>
<p>&nbsp;</p>
<p>Here you go &ndash; <strong>the content length is too long. </strong>It also provides the length of the content attempted to be uploaded as well. Pretty neat logging!<strong></strong></p>
<p><strong>&nbsp;</strong></p>
<p>Jumped directly into the URLSCAN configuration file (Default Location - C:\Windows\System32\inetsrv\urlscan\UrlScan.ini) and found the below comment in the configuration file &ndash;</p>
<p><em>;&nbsp;&nbsp; - <strong>MaxAllowedContentLength</strong> specifies the maximum allowed</em></p>
<p><em>;&nbsp;&nbsp;&nbsp;&nbsp; numeric value of the Content-Length request header.&nbsp; For</em></p>
<p><em>;&nbsp;&nbsp;&nbsp;&nbsp; example, setting this to 1000 would cause any request</em></p>
<p><em>;&nbsp;&nbsp;&nbsp;&nbsp; with a content length that exceeds 1000 to be rejected.</em></p>
<p><em>;&nbsp;&nbsp;&nbsp;&nbsp; The default is 30000000.</em></p>
<p>The default max. allowed content length was 30 MB. We altered this configuration and increased the parameter to a higher value to fix the problem.&nbsp;</p>
<p>&nbsp;</p>
<p><span>Disclaimer: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Inappropriate comments will be deleted at the authors discretion. All code samples are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular.</span></p>]]></content:encoded>
    </item>
    <item>
      <title>Oh, not again! SQL Server Service is not starting…</title>
      <link>https://docs.microsoft.com/archive/blogs/techreflections/oh-not-again-sql-server-service-is-not-starting</link>
      <pubDate>Sat, 16 May 2015 08:56:00 GMT</pubDate>
      <dc:creator><![CDATA[Devashish_Salgaonkar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/techreflections/2015/05/16/oh-not-again-sql-server-service-is-not-starting/</guid>
      <description><![CDATA[The other day I came across a very common but intriguing scenario of SQL Server service NOT...]]></description>
      <content:encoded><![CDATA[<p>The other day I came across a very common but intriguing scenario of SQL Server service NOT starting. Initially when I came across this issue, I felt that this would not take much of my time but interestingly it did not turn out as I thought!</p>
<p>This was actually the SQL Server resource which was not coming ONLINE. As usual the DBA said <strong>NOTHING changed, it just happened</strong>!!</p>
<p>One of the first things we normally do is to start the service from the SQL Server Configuration Manager/Services console so that we can isolate the issue. In this case we found that the service was failing to start with the below errors:-</p>
<p>---------------------<br /> TITLE: Services<br /> ---------------------<br /> Windows could not start the SQL Server (MSSQLSERVER) service on Local Computer.<br /> Error 1053: The service did not respond to the start or control request in a timely Fashion.<br /> Button: OK<br /> --------------------</p>
<p>Generic error, you don&rsquo;t expect much from the GUI anyways!! Went for the SQL Server Errorlogs and Application/System Event viewer logs. We did not find the Errorlog created in the SQL Server folder nor did any errors get logged in the Application/System logs.</p>
<p>Commonly, in such scenarios, the start-up parameters are goofed up but in this case it was not.</p>
<p>So the next logical step was to start the service in the command prompt in console mode:-</p>
<p><strong>C:\Windows\system32&gt;"C:\Program Files\Microsoft SQL Server\MSSQL10_50.R2\MSSQL\B</strong><strong>inn\sqlservr.exe" -sR2 &ndash;c</strong></p>
<p><strong>_</strong></p>
<p>It did show any message indicating that the service in not even initialising. It appeared that it was sort of in a hung state. Strange!!</p>
<p>Then I pulled out the next tool from my toolkit: - PROCESS MONITOR a.k.a PROCMON (I hope most of you get the reason why I put that in CAPS for those of you who did not ..read on)</p>
<p>So I collected a PROCMON while running the service in command prompt. I filter it on SQLServr.exe and here is what I find.</p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/0044.Proc1.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/0044.Proc1.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/0044.Proc1.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/0044.Proc1.png" alt="" border="0" /></a></p>
<p>I see that SQL Server accesses the ERRORLOG file but continues to perform a delete operation on files like ERRORLOG.321234533, ERRORLOG.321234532, ERRORLOG.321234531..Why would SQL do this and why these weird files names??</p>
<p>&nbsp;</p>
<p>Scratching my head for some time and looking at the PROCMON output for some more time I figured it out. I see that before SQL attempts this file deletion it accesses the below registry key</p>
<p>Event Class:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Registry</p>
<p>Operation:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RegQueryValue</p>
<p>Result:&nbsp; SUCCESS</p>
<p>Path:&nbsp;&nbsp;&nbsp;&nbsp; HKLM\SOFTWARE\MICROSOFT\Microsoft SQL Server\MSSQL10_50.R2\MSSQLServer\<span style="background-color: #ffff00;">NumErrorLogs</span></p>
<p>Type:&nbsp;&nbsp;&nbsp;&nbsp; REG_DWORD</p>
<p>Length: 4</p>
<p>Data:&nbsp;&nbsp;&nbsp;&nbsp; <span style="background-color: #ffff00;">321234534</span></p>
<p>&nbsp;</p>
<p>But now what is NumErrorLogs and when would that be set??</p>
<p>Remember there is an option in SQL Server where you can customise the Number of Errorlogs to be retained, by default its 6.</p>
<p>&nbsp;</p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/8424.Img2.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/8424.Img2.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/8424.Img2.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/8424.Img2.png" alt="" border="0" /></a></p>
<p>&nbsp;</p>
<p>To confirm my understanding, I set this to 99 and collected a PROCMON on my test machine.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/1234.Img3.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/1234.Img3.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/71/19/1234.Img3.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-71-19/1234.Img3.png" alt="" border="0" /></a>&nbsp;</p>
<p>I see the similar symptoms of the Errorlogs being attempted to be deleted.</p>
<p>In short, what is happening is that SQL Server is internally is attempting to delete/rename the Errorlog files and arrange it so that only 99 or less Errorlog files are retained!!! Now since the registry key is set to such a high value SQL Server is looking for the Errorlogs and decrementing the number every time and hence it SQL Server appears to be hung!!!</p>
<p>But if you notice, the maximum value which can be set here is 99. So how does the NumErrorLogs registry key has such a high value??</p>
<p>No points for cracking that. The possible options for that happening:-</p>
<ol>
<li>Manual intervention of changing this registry key</li>
<li>Running something like below in SQL Server</li>
</ol>
<p>USE [master]<br /> GO<br /> EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'NumErrorLogs', REG_DWORD, 321234533<br /> GO</p>
<p>&nbsp;</p>
<p>So finally, we go ahead and change the registry key back to the default value and BINGO SQL Server starts up!! Issue resolved!!</p>
<p>Before signing off, credits to <a title="Mark Russinovich" href="https://twitter.com/markrussinovich">Mark Russinovich </a>for the tool <a title="Process Monitor" href="https://technet.microsoft.com/en-us/library/bb896645.aspx" target="_blank">PROCESS MONITOR </a>without which I feel this issue could NEVER have been resolved!!</p>
<p><span>Disclaimer: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Inappropriate comments will be deleted at the authors discretion. All code samples are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular.</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
  </channel>
</rss>