<?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>Gaurav's Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/gaurav/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/gaurav/feed.xml</link>
    <description />
    <lastBuildDate>Sat, 19 Nov 2016 19:52:23 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Fix: Failed to open/create the internal network 'HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter'. Error “VERR_INTNET_FLT_IF_NOT_FOUND” with Docker QuickStart Terminal and inside Oracle Virtual Box</title>
      <link>https://docs.microsoft.com/archive/blogs/gaurav/fix-failed-to-opencreate-the-internal-network-hostinterfacenetworking-virtualbox-host-only-ethernet-adapter-error-verr_intnet_flt_if_not_found-with-docker-quickstart-terminal</link>
      <pubDate>Sat, 19 Nov 2016 19:52:23 GMT</pubDate>
      <dc:creator><![CDATA[Gaurava K Arya]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/gaurav/?p=145</guid>
      <description><![CDATA[During setup of Docker on my laptop, i faced this issue. I tried a few things suggested on the web...]]></description>
      <content:encoded><![CDATA[During setup of Docker on my laptop, i faced this issue. I tried a few things suggested on the web but could not find out one source of truth to resolve this issue. I am writing this blog so that .

<strong>Error: </strong>Below is the exact error message that we get in <span>Docker QuickStart Terminal when launched first time</span>.
<div class="post">
<div class="body">
<div id="e02d5a58-bd14-4350-8fb1-52f7f3474656" class="postBody" style="margin: 4px 0px 0px;border-width: 0px;padding: 0px">
<table cellspacing="0" cellpadding="2" width="400" border="0">
<tbody>
<tr>
<td valign="top" width="400">
<pre><code>Failed to open a session for the virtual machine default.                                                                    

Failed to open/create the internal network 'HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter #2' (VERR_INTNET_FLT_IF_NOT_FOUND).

Failed to attach the network LUN (VERR_INTNET_FLT_IF_NOT_FOUND).

Result Code: E_FAIL (0x80004005)
Component: ConsoleWrap
Interface: IConsole {872da645-4a9b-1727-bee2-5585105b9eed}</code></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
A unique key to search about this error on web would be "<code>VERR_INTNET_FLT_IF_NOT_FOUND</code>". The adapter number given in the above error message may differ for different people depending on number of installation/un-installation they have tried. Anyway, the main question still is "Why do we get this error?"

This error message shows up in Docker QuickStart Terminal after installation. We can see the same error "<span>VERR_INTNET_FLT_IF_NOT_FOUND</span>" in Oracle Virtual Box as well. Launch Oracle VirtualBox and try to start Default VM, you will see the same error there.

<strong>Reason:</strong>

The reason for this error is that we overlook the fourth option in this given window while installing Docker Tool Box. And because of this, VirtualBox Bridged Networking Driver goes unchecked or sometimes checked but remain uneffective[Potential Bug].

.<a href="https://msdnshared.blob.core.windows.net/media/2016/11/Reason11.png"><img src="https://msdnshared.blob.core.windows.net/media/2016/11/Reason11-300x232.png" alt="reason1" width="548" height="424" class="alignnone  wp-image-175" /></a>

&nbsp;

<strong>Solution:</strong>
<ol>
 	<li>First solution is to uninstall and reinstall Docker Tool Box with shown checkbox as checked.</li>
 	<li>Second solution I have not tried myself but i have heard worked for many people.
<ul>
 	<li>Open <strong>Internet Connections</strong>.</li>
 	<li>Select<strong> Properties </strong>of the connection VirtualBox Host-Only Network #2 [Number can vary]</li>
 	<li>Uncheck and check the checkbox against shown highlighted.</li>
 	<li>Disable and enable the network connection.</li>
 	<li><a href="https://msdnshared.blob.core.windows.net/media/2016/11/VirtualBoxNetworkDriver.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2016/11/VirtualBoxNetworkDriver-300x228.jpg" alt="virtualboxnetworkdriver" width="428" height="324" class="alignnone  wp-image-176" /></a></li>
</ul>
</li>
</ol>
&nbsp;

I hope this helps. Please don't forget to write feedback.

Thanks

Gaurav]]></content:encoded>
    </item>
    <item>
      <title>JavaScript: String.Split with StringSplitOptions, Array removeEntries</title>
      <link>https://docs.microsoft.com/archive/blogs/gaurav/javascript-string-split-with-stringsplitoptions-array-removeentries</link>
      <pubDate>Sat, 11 Apr 2015 06:32:07 GMT</pubDate>
      <dc:creator><![CDATA[Gaurava K Arya]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/gaurav/2015/04/11/javascript-string-split-with-stringsplitoptions-array-removeentries/</guid>
      <description><![CDATA[&#160;  You would have used String.Split in C# a lot of times and would have appreciated options...]]></description>
      <content:encoded><![CDATA[<p>&#160;</p>  <p>You would have used String.Split in C# a lot of times and would have appreciated options available like StringSplitOptions. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/0434.image_5151506E.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/0434.image_5F00_5151506E.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/8713.image_thumb_7D21A45D.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/8713.image_5F00_thumb_5F00_7D21A45D.png" width="745" height="94" /></a> </p>  <p> Sometimes, we need similar split options in JavaScript as well. I have written this utility method which you can use&#160; I have extended JavaScript “String” class using string prototype to add this method in all your string variables.</p>  <p> String.prototype.splitWithStringSplitOptions = function (splitBy, removeItemString) {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (this == &quot;&quot;) {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return new Array();     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var items = this.split(splitBy); </p>  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (var i = 0; i &lt; items.length; i++) {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (items[i] == removeItemString) {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; items.splice(i, 1);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; i--;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return items;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>  <p>You can call this methods below. This call removes empty string items from the array.</p>  <p>function UseStringSplitter() {    <br />&#160;&#160;&#160; var value = &quot;a,b,,c,,d&quot;;     <br />&#160;&#160;&#160; var array = value.splitWithStringSplitOptions(&quot;,&quot;, &quot;&quot;);     <br />&#160;&#160;&#160; console.log(value);     <br />}</p>  <p>Alternatively, following method can also be used to remove specific items from any JavaScript array</p>  <p>&#160;&#160;&#160;&#160; Array.prototype.IgnoreItems = function (ignoreItem) {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (this.length &lt; 1) {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return this;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </p>  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (var i = 0; i &lt; this.length; i++) {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (this[i] == ignoreItem) {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.splice(i, 1);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; i--;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return this;     <br />&#160;&#160;&#160;&#160; }</p>  <p>&#160;</p>  <p>Calling above methods with below parameters removes item “a” from the array.</p>  <p>function RemoveItemsFromArray() {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var value = &quot;a,b,d,a,m&quot;;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var array = value.split(&quot;,&quot;);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; array.removeEntries(&quot;a&quot;);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; console.log(value);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>  <p> Hope this helps. Happy Coding!</p>  <p> Thanks</p>  <p>Gaurav</p>]]></content:encoded>
    </item>
    <item>
      <title>The web server process that was being debugged has been terminated by Internet Information Services (IIS). This can be avoided by configuring Application Pool ping settings in IIS.</title>
      <link>https://docs.microsoft.com/archive/blogs/gaurav/the-web-server-process-that-was-being-debugged-has-been-terminated-by-internet-information-services-iis-this-can-be-avoided-by-configuring-application-pool-ping-settings-in-iis</link>
      <pubDate>Fri, 16 Jan 2015 04:39:35 GMT</pubDate>
      <dc:creator><![CDATA[Gaurava K Arya]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/gaurav/2015/01/16/the-web-server-process-that-was-being-debugged-has-been-terminated-by-internet-information-services-iis-this-can-be-avoided-by-configuring-application-pool-ping-settings-in-iis/</guid>
      <description><![CDATA[&#160;  A lot of developers might have seen following dialog box while debugging any web application...]]></description>
      <content:encoded><![CDATA[<p>&#160;</p>  <p>A lot of developers might have seen following dialog box while debugging any web application in Microsoft Visual Studio. </p>  <p><strong>“The web server process that was being debugged has been terminated by Internet Information Services (IIS). This can be avoided by configuring Application Pool ping settings in IIS. See help for further details.”</strong></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/4341.image_532C30D5.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/4341.image_5F00_532C30D5.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/4784.image_thumb_0AFE74F9.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/4784.image_5F00_thumb_5F00_0AFE74F9.png" width="496" height="232" /></a> </p>  <p>&#160;</p>  <h3>Explanation:</h3>  <p>This issue happens when<strong> you have hosted your web application in IIS</strong> and have attached the debugger to the worker process. </p>  <p>While debugging, you might stop at any particular line for some long time for any reason say some calculation, quick watch window etc, so when debugger stops execution of the code, Internet Information Services (IIS) assumes that worker process has stopped responding and terminates that worker process. Subsequently, Visual Studio will show this dialog box since it’s debugger was attached to that process. So question might arise <strong>how does IIS gets to know if any process is stopped or is hung?</strong> Answer to this question lies in the solution explained below.</p>  <h3>Solution:</h3>  <p>When we host any application in the IIS, most of the times, we do not change the default settings and our application inherits settings defined at the IIS level. Here are two such settings which can cause above issue if not set properly. To change these settings, follow below steps.</p>  <p>1. Launch <strong>IIS manager</strong>, select <strong>application pool</strong> of the website, click on <strong>advanced settings</strong>. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/0181.image_57C23B8F.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/0181.image_5F00_57C23B8F.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/1184.image_thumb_373AFBDD.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/1184.image_5F00_thumb_5F00_373AFBDD.png" width="152" height="297" /></a>&#160;</p>  <p>&#160;</p>  <p>2. You will see following dialog box. You see following two settings. You can use <strong>any one of the below</strong> given settings to resolve this issue.&#160; </p>  <blockquote>   <p>a. Ping Enabled –&gt; Set to False</p> </blockquote>  <blockquote>   <p>b. Ping Maximum Response Time –&gt; Set some higher number.</p> </blockquote>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/1805.image_2AC232E3.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/1805.image_5F00_2AC232E3.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/2477.image_thumb_4A076A67.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/2477.image_5F00_thumb_5F00_4A076A67.png" width="471" height="432" /></a></p>      <p>&#160;</p>  <p><strong>Ping Enabled: </strong>This feature is for monitoring and improving application pool health by having the Windows Process Activation Service (WAS) ping an application pool's worker process at set intervals. Setting it turned off will stop IIS from checking whether the worker process is still running or if this is hung, which will stop IIS from reporting it.</p>  <p><strong>Explanation:</strong> If true, the worker process(es) serving this application pool are pinged periodically to ensure that they are still responsive. This process is called <strong>health monitoring</strong>. </p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/0211.image_5E2317A1.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/0211.image_5F00_5E2317A1.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/1307.image_thumb_3FD860AB.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/1307.image_5F00_thumb_5F00_3FD860AB.png" width="471" height="78" /></a></p>  <p>&#160;</p>  <p><strong>Ping Maximum Response Time: </strong>This will increase the waiting time of a Ping request, IIS will wait for.</p>  <p>Maximum time that a worker process is given to respond to a health monitoring ping. If the worker process does not respond, it is terminated.</p>  <h5>Above two settings make sure that IIS is aware of the current state of the worker process. Hence, above settings can be manipulated as per application performance but should not be disabled completely in production environments. </h5>  <p>&#160;<strong><font color="#ff0000">Note: These settings should not be changed in Production environment.</font></strong></p>  <h5><font color="#000000"><font style="font-weight: bold">Why these settings should not be changed:</font> </font></h5>  <h5><font color="#000000">These settings are meant for health monitoring, reporting and to enable the WAS process to kill/restart the worker process whenever this is unhealthy. Whenever worker process is not healthy, this should be killed and also reported. If you disable this ping feature or increase this response time, requests will be waiting for the process to come responsive and your website performance will be hit.</font></h5>  <p>&#160;</p>  <p>References:</p>  <p><a title="http://msdn.microsoft.com/en-us/library/bb763108.aspx" href="http://msdn.microsoft.com/en-us/library/bb763108.aspx">http://msdn.microsoft.com/en-us/library/bb763108.aspx</a></p>  <p><a title="http://technet.microsoft.com/en-us/library/cc725836(v=ws.10).aspx" href="http://technet.microsoft.com/en-us/library/cc725836(v=ws.10).aspx">http://technet.microsoft.com/en-us/library/cc725836(v=ws.10).aspx</a></p>  <p><a title="http://blogs.msdn.com/b/webdevelopertips/archive/2009/03/30/tip-48-did-you-know-that-iis7-application-pool-s-ping-settings-may-affect-iis7-based-website-or-application-debugging.aspx" href="http://blogs.msdn.com/b/webdevelopertips/archive/2009/03/30/tip-48-did-you-know-that-iis7-application-pool-s-ping-settings-may-affect-iis7-based-website-or-application-debugging.aspx">http://blogs.msdn.com/b/webdevelopertips/archive/2009/03/30/tip-48-did-you-know-that-iis7-application-pool-s-ping-settings-may-affect-iis7-based-website-or-application-debugging.aspx</a></p>  <p><a title="http://blogs.msdn.com/b/jjameson/archive/2010/04/21/disable-pinging-of-your-application-pool-worker-process-in-iis.aspx" href="http://blogs.msdn.com/b/jjameson/archive/2010/04/21/disable-pinging-of-your-application-pool-worker-process-in-iis.aspx">http://blogs.msdn.com/b/jjameson/archive/2010/04/21/disable-pinging-of-your-application-pool-worker-process-in-iis.aspx</a></p>  <p>Please let me know if you have any questions. </p>  <p>Thanks</p>  <p>Gaurav</p>]]></content:encoded>
    </item>
    <item>
      <title>Line numbers in Visual Studio not shown?</title>
      <link>https://docs.microsoft.com/archive/blogs/gaurav/line-numbers-in-visual-studio-not-shown</link>
      <pubDate>Thu, 24 Jul 2014 00:31:29 GMT</pubDate>
      <dc:creator><![CDATA[Gaurava K Arya]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/gaurav/2014/07/24/line-numbers-in-visual-studio-not-shown/</guid>
      <description><![CDATA[&#160;  At times, you see that line numbers are not coming up in Visual Studio. In fact, this is a...]]></description>
      <content:encoded><![CDATA[<p>&#160;</p>  <p>At times, you see that line numbers are not coming up in Visual Studio. In fact, this is a setting which can be customized as per your need. You can even enable or disable this feature as per the file types.</p>  <p>Go to <strong>Tools –&gt; Options </strong>and select <strong>Text Editor </strong>and enable line numbers as shown 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/61/53/metablogapi/2376.image_7C42EF34.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/2376.image_5F00_7C42EF34.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/6076.image_thumb_2AD8F817.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/6076.image_5F00_thumb_5F00_2AD8F817.png" width="541" height="364" /></a> </p>  <p>&#160;</p>  <p>You can see that it is also showing all other languages. You can customize a lot of other settings related to editors. You can also explore them. :)</p>  <p>&#160;</p>  <p>Thanks</p>  <p>Gaurav</p>]]></content:encoded>
    </item>
    <item>
      <title>Security Identifier(SID): GetSID of a user,object using Registry, WMIC, PowerShell</title>
      <link>https://docs.microsoft.com/archive/blogs/gaurav/security-identifiersid-getsid-of-a-userobject-using-registry-wmic-powershell</link>
      <pubDate>Tue, 03 Jun 2014 07:02:11 GMT</pubDate>
      <dc:creator><![CDATA[Gaurava K Arya]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/gaurav/2014/06/03/security-identifiersid-getsid-of-a-userobject-using-registry-wmic-powershell/</guid>
      <description><![CDATA[At times, we are in a situation when need to identify the SID of any object. The security identifier...]]></description>
      <content:encoded><![CDATA[<p>At times, we are in a situation when need to identify the SID of any object. The security identifier (SID) structure is a variable-length structure used to uniquely identify users or groups. For more information <a href="http://msdn.microsoft.com/en-us/library/cc246018.aspx">Refer here</a>&#160;</p>  <p>We have different ways to identify the SID of any object. However, my main objective of writing this blog is to point out the PowerShell option, I will still list out other options. </p>  <p>&#160;</p>  <h4><strong>1. Using PSGetSID</strong></h4>  <blockquote>   <p>We can use this sysinternal’s tool PsGetSid <a title="http://technet.microsoft.com/en-in/sysinternals/bb897417.aspx" href="http://technet.microsoft.com/en-in/sysinternals/bb897417.aspx">http://technet.microsoft.com/en-in/sysinternals/bb897417.aspx</a> but you will have to download this and than run this. </p> </blockquote>  <p><strong>2. By looking at the Registry: </strong>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList</p>  <blockquote>   <p>We can look at these registry hives at following path. Each of the item at this hive is named with the SID of the account. By looking at the ProfileImagePath key under specific account’s hive, you can identify the account’s name. Like below, we can see this is for “NetworkService” account.</p> </blockquote>  <blockquote>   <p>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList</p>    <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/1464.image_573A444D.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/1464.image_5F00_573A444D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/6746.image_thumb_51EDEE4D.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/6746.image_5F00_thumb_5F00_51EDEE4D.png" width="984" height="294" /></a>&#160;</p> </blockquote>  <blockquote>   <p>Also, like below, selected item is for a user named “gaurav” and it’s SID is the name of the hive.</p>    <p>&#160;</p>    <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/1830.image_47BEE491.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/1830.image_5F00_47BEE491.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/4606.image_thumb_34A04896.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/4606.image_5F00_thumb_5F00_34A04896.png" width="992" height="147" /></a> </p> </blockquote>  <blockquote>   <p>This approach has one <strong>limitation</strong> which is you can only get the SID of either a <strong>local user </strong>or <strong>a domain user who has logged in </strong>at least once onto this machine.</p> </blockquote>  <h4><strong>3. WMIC</strong></h4>  <blockquote>   <p>There is this approach which we can use and will work in all of the cases except on any OS prior to Windows XP. We will use WMI commands to find out the SID of any user within the network. Like below, in the following command, gauravtestMachine is the computer name. </p> </blockquote>  <blockquote>   <h4><strong>wmic useraccount where (name='administrator' and domain='gauravtestMachine') get name,sid</strong></h4>    <br />    <p>Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SID      <br />administrator&#160; S-1-5-21-1976753858-2077894621-3616986626-500</p>    <p></p> </blockquote>  <blockquote>   <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/7853.image_6F1DD91B.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/7853.image_5F00_6F1DD91B.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/6170.image_thumb_17BC4523.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/6170.image_5F00_thumb_5F00_17BC4523.png" width="1116" height="147" /></a> </p>    <p>We can run the same command if we want to get the SID of a domain user by replacing domain value with the actual value.</p> </blockquote>  <p>&#160;</p>  <h3>4. Using PowerShell</h3>  <blockquote>   <p>Since the focus is on PowerShell, I have give a feWe have got yet another option to fetch the SID using the PowerShell command which i think is the most suitable and convenient option.&#160; Here is the command. Please remember that this command has to be exactly like this. If you put an extra space, that can cause a problem. </p> </blockquote>  <blockquote>   <h3><strong>A. For a domain user </strong></h3>    <p><strong></strong></p>    <h4>PS C:\Users\Administrator&gt; <strong>[wmi] &quot;win32_userAccount.Domain='webfarm',Name='testuser'&quot; </strong></h4>    <p>AccountType : 512      <br />Caption&#160;&#160;&#160;&#160; : webfarm\testuser       <br />Domain&#160;&#160;&#160;&#160;&#160; : webfarm       <br />SID&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : S-1-5-21-2536614405-3629634762-1218571035-1116       <br />FullName&#160;&#160;&#160; : Test User       <br />Name&#160;&#160;&#160;&#160;&#160;&#160;&#160; : testuser</p>    <p>&#160;</p> </blockquote>  <blockquote>   <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/6253.image_64829C6A.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/6253.image_5F00_64829C6A.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/1667.image_thumb_6172CF26.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/1667.image_5F00_thumb_5F00_6172CF26.png" width="1126" height="199" /></a> </p> </blockquote>  <p>&#160;</p>  <blockquote>   <h3><strong>B.</strong> <strong>For a local user,</strong>&#160;</h3>    <h5>You just have to replace the Domain value with the computer name and your command should look like this.</h5>    <h4>PS C:\Users\gaarya&gt;<strong> [wmi] &quot;Win32_userAccount.Domain='gauravkarya',Name='Administrator'&quot;</strong></h4> </blockquote>  <blockquote>   <p>AccountType : 512      <br />Caption&#160;&#160;&#160;&#160; : gauravkarya\Administrator       <br />Domain&#160;&#160;&#160;&#160;&#160; : gauravkarya       <br />SID&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : S-1-5-21-1976753858-2077894621-3616986626-500       <br />FullName&#160;&#160;&#160; :       <br />Name&#160;&#160;&#160;&#160;&#160;&#160;&#160; : Administrator</p> </blockquote>  <blockquote>   <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/2781.image_6E030CF3.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/2781.image_5F00_6E030CF3.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/1018.image_thumb_2B92FB6E.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/1018.image_5F00_thumb_5F00_2B92FB6E.png" width="1121" height="210" /></a> </p> </blockquote>  <p>&#160;</p>  <p></p>  <p></p>  <p></p>  <p></p>  <p></p>  <p></p>  <blockquote>   <p><strong>Alternatively,</strong> you can also use PowerShell cmdlet Get-WmiObject rather than using [WMI]. Get-WmiObject is just a PowerShell way of using WMI.</p> </blockquote>  <blockquote>   <h4><strong>PS C:\Users\Administrator&gt; Get-WmiObject win32_useraccount -Filter &quot;name = 'testuser' AND domain = 'webfarm'&quot;</strong> </h4> </blockquote>  <blockquote>   <p>AccountType : 512      <br />Caption&#160;&#160;&#160;&#160; : WEBFARM\testuser       <br />Domain&#160;&#160;&#160;&#160;&#160; : WEBFARM       <br />SID&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; :&#160; S-1-5-21-2536614405-3629634762-1218571035-1116       <br />FullName&#160;&#160;&#160; : Test User       <br />Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : testuser</p> </blockquote>  <blockquote>   <p>&#160;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/4682.image_3ED642BE.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/4682.image_5F00_3ED642BE.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/4174.image_thumb_1E5193BD.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/4174.image_5F00_thumb_5F00_1E5193BD.png" width="1115" height="163" /></a> </p> </blockquote>  <p>&#160;</p>  <p></p>  <p>I think that above PowerShell approach is the easiest one. However, you find yet another way of doing this only using PowerShell cmdlets here <a href="http://technet.microsoft.com/en-us/library/ff730940.aspx">Windows PowerShell Tip of the Week</a>.</p>  <p>&#160;</p>  <p>Please feel free to write the feedback.</p>  <p>&#160;</p>  <p>Thanks</p>  <p>Gaurav</p>  <p>&#160;</p>  <p>References</p>  <p>==============</p>  <p>1. <a title="http://technet.microsoft.com/en-us/library/ff730940.aspx" href="http://technet.microsoft.com/en-us/library/ff730940.aspx">http://technet.microsoft.com/en-us/library/ff730940.aspx</a></p>  <p>2. <a title="http://blogs.technet.com/b/heyscriptingguy/archive/2010/10/11/use-wmi-and-powershell-to-get-a-user-s-sid.aspx" href="http://blogs.technet.com/b/heyscriptingguy/archive/2010/10/11/use-wmi-and-powershell-to-get-a-user-s-sid.aspx3">http://blogs.technet.com/b/heyscriptingguy/archive/2010/10/11/use-wmi-and-powershell-to-get-a-user-s-sid.aspx3</a></p>  <p>3. <a title="http://blogs.technet.com/b/askperf/archive/2012/02/17/useful-wmic-queries.aspx" href="http://blogs.technet.com/b/askperf/archive/2012/02/17/useful-wmic-queries.aspx">http://blogs.technet.com/b/askperf/archive/2012/02/17/useful-wmic-queries.aspx</a></p>  <p>4. <a title="http://msdn.microsoft.com/en-us/library/aa394507(v=vs.85).aspx" href="http://msdn.microsoft.com/en-us/library/aa394507(v=vs.85).aspx">http://msdn.microsoft.com/en-us/library/aa394507(v=vs.85).aspx</a></p>  <p>5. <a title="http://msdn.microsoft.com/en-us/library/aa826699(v=vs.85).aspx" href="http://msdn.microsoft.com/en-us/library/aa826699(v=vs.85).aspx">http://msdn.microsoft.com/en-us/library/aa826699(v=vs.85).aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>SQL Express LocalDB and it’s deployment on IIS server</title>
      <link>https://docs.microsoft.com/archive/blogs/gaurav/sql-express-localdb-and-its-deployment-on-iis-server</link>
      <pubDate>Tue, 04 Feb 2014 04:20:15 GMT</pubDate>
      <dc:creator><![CDATA[Gaurava K Arya]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/gaurav/2014/02/04/sql-express-localdb-and-its-deployment-on-iis-server/</guid>
      <description><![CDATA[This blogs talks about the latest version of SQL Express database, also known as LocalDB and about a...]]></description>
      <content:encoded><![CDATA[<p>This blogs talks about the latest version of SQL Express database, also known as LocalDB and about a specific issue when SQL Express LocalDB is deployed on IIS server.</p>  <p>Here is the link to the blog post: <a title="http://blogs.msdn.com/b/gaurav/archive/2013/12/21/deployment-of-sql-express-localdb-on-iis.aspx" href="http://blogs.msdn.com/b/gaurav/archive/2013/12/21/deployment-of-sql-express-localdb-on-iis.aspx">http://blogs.msdn.com/b/gaurav/archive/2013/12/21/deployment-of-sql-express-localdb-on-iis.aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>The view must derive from WebViewPage, or WebViewPage&lt;TModel&gt;. (The view at '~/Views/home/index.cshtml' must derive from WebViewPage, or WebViewPage&lt;TModel&gt;.)</title>
      <link>https://docs.microsoft.com/archive/blogs/gaurav/the-view-must-derive-from-webviewpage-or-webviewpagetmodel-the-view-at-viewshomeindex-cshtml-must-derive-from-webviewpage-or-webviewpagetmodel</link>
      <pubDate>Tue, 14 Jan 2014 23:55:01 GMT</pubDate>
      <dc:creator><![CDATA[Gaurava K Arya]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/gaurav/2014/01/14/the-view-must-derive-from-webviewpage-or-webviewpagetmodel-the-view-at-viewshomeindex-cshtml-must-derive-from-webviewpage-or-webviewpagetmodel/</guid>
      <description><![CDATA[I am writing this blog to help you understand the following scenario which you can see sometime...]]></description>
      <content:encoded><![CDATA[<p>I am writing this blog to help you understand the following scenario which you can see sometime while working on the ASP.NET MVC website. You are prone to get this error message if you are using ASP.NET Razor view syntax and specifically </p>  <p>not using the Visual Studio provided template to develop an ASP.NET MVC website or you have removed some files while customizing the template. Let’s try to understand this scenario. </p>  <p>&#160;</p>  <p><i>The view at '~/Views/home/index.cshtml' must derive from WebViewPage, or WebViewPage&lt;TModel&gt;.</i></p> <b>Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.   <br /><b>Exception Details: </b>System.InvalidOperationException: The view at '~/Views/home/index.cshtml' must derive from WebViewPage, or WebViewPage&lt;TModel&gt;.&#160; <br />  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/4062.image_58B1D828.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/4062.image_5F00_58B1D828.png"><img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/5582.image_thumb_146EE02B.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/5582.image_5F00_thumb_5F00_146EE02B.png" width="739" height="281" /></a> </p>  <p>&#160;</p>  <p>To easily understand this issue, we need to understand the WebViewPage class first. Here is the MSDN documentation <a title="http://msdn.microsoft.com/en-us/library/system.web.mvc.webviewpage(v=vs.118).aspx" href="http://msdn.microsoft.com/en-us/library/system.web.mvc.webviewpage(v=vs.118).aspx">http://msdn.microsoft.com/en-us/library/system.web.mvc.webviewpage(v=vs.118).aspx</a> which says “WebViewPage class represents the properties and methods that are needed in order to render a view that uses ASP.NET Razor syntax.”</p>  <p>&#160;</p>  <p>So since we know that this is required component to get Razor syntax working, we need to find out the solution now. Easiest solution can be #1 given following and which is as per the error message says, view must derive from WebViewPage.</p>  <p>&#160;</p>  <p><strong>Solution 1.</strong> </p>  <p>Add following line on top of your cshtml file. </p>  <p><span class="preproc">@inherits</span> System.Web.Mvc.WebViewPage</p>  <p>&#160;</p>  <p>You must be wondering now thinking that views in ASP.NET MVC templates do not have this line on top of the cshtml file? So let’s see the second solution.</p>  <p><font size="2"><strong>Solution 2. </strong></font></p>  <p>Add a web.config file&#160; and specify the same setting for all the views. This&#160; is the minimum required code in this configuration file to get rid of this error message. </p>  <pre class="code"><span style="background: white; color: blue">&lt;?</span><span style="background: white; color: #a31515">xml </span><span style="background: white; color: red">version</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">&quot;</span><span style="background: white; color: blue">1.0</span><span style="background: white; color: black">&quot;</span><span style="background: white; color: blue">?&gt;
&lt;</span><span style="background: white; color: #a31515">configuration</span><span style="background: white; color: blue">&gt;
  &lt;</span><span style="background: white; color: #a31515">configSections</span><span style="background: white; color: blue">&gt;
    &lt;</span><span style="background: white; color: #a31515">sectionGroup </span><span style="background: white; color: red">name</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">&quot;</span><span style="background: white; color: blue">system.web.webPages.razor</span><span style="background: white; color: black">&quot; </span><span style="background: white; color: red">type</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">&quot;</span><span style="background: white; color: blue">System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, 
                  System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35</span><span style="background: white; color: black">&quot;</span><span style="background: white; color: blue">&gt;
      &lt;</span><span style="background: white; color: #a31515">section </span><span style="background: white; color: red">name</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">&quot;</span><span style="background: white; color: blue">host</span><span style="background: white; color: black">&quot; </span><span style="background: white; color: red">type</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">&quot;</span><span style="background: white; color: blue">System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, 
               Version=2.0.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35</span><span style="background: white; color: black">&quot; </span><span style="background: white; color: red">requirePermission</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">&quot;</span><span style="background: white; color: blue">false</span><span style="background: white; color: black">&quot; </span><span style="background: white; color: blue">/&gt;
      &lt;</span><span style="background: white; color: #a31515">section </span><span style="background: white; color: red">name</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">&quot;</span><span style="background: white; color: blue">pages</span><span style="background: white; color: black">&quot; </span><span style="background: white; color: red">type</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">&quot;</span><span style="background: white; color: blue">System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor,
               Version=2.0.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35</span><span style="background: white; color: black">&quot; </span><span style="background: white; color: red">requirePermission</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">&quot;</span><span style="background: white; color: blue">false</span><span style="background: white; color: black">&quot; </span><span style="background: white; color: blue">/&gt;
    &lt;/</span><span style="background: white; color: #a31515">sectionGroup</span><span style="background: white; color: blue">&gt;
  &lt;/</span><span style="background: white; color: #a31515">configSections</span><span style="background: white; color: blue">&gt;
  
  &lt;</span><span style="background: white; color: #a31515">system.web.webPages.razor</span><span style="background: white; color: blue">&gt;
    &lt;</span><span style="background: white; color: #a31515">pages </span><span style="background: white; color: red">pageBaseType</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">&quot;</span><span style="background: white; color: blue">System.Web.Mvc.WebViewPage</span><span style="background: white; color: black">&quot; </span><span style="background: white; color: blue">&gt;&lt;/</span><span style="background: white; color: #a31515">pages</span><span style="background: white; color: blue">&gt;
  &lt;/</span><span style="background: white; color: #a31515">system.web.webPages.razor</span><span style="background: white; color: blue">&gt;
&lt;/</span><span style="background: white; color: #a31515">configuration</span><span style="background: white; color: blue">&gt;</span></pre>

<pre class="code"><span style="background: white; color: blue"></span><span style="background: white; color: blue"><br /></span></pre>
<a href="http://11011.net/software/vspaste"></a>

<p>Actual setting required is <span class="attr">pageBaseType</span><span class="kwrd">=&quot;System.Web.Mvc.WebViewPage&quot;. Other text is only required to define the tags.</span></p>

<p>&#160;</p>

<p>If you will create an ASP.NET MVC website using the Visual Studio provided default templates, you can see that Views folder already contains this web.config file. However, this file contains a lot of other required configuration as well.</p>

<p>&#160;</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/4135.image_3E244F1C.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/4135.image_5F00_3E244F1C.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/2500.image_thumb_5C6F0612.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/2500.image_5F00_thumb_5F00_5C6F0612.png" width="236" height="356" /></a>&#160; </p>

<p>Please let me know the feedback or concerns. </p>

<p>Thanks,</p>

<p>Gaurav</p>]]></content:encoded>
    </item>
    <item>
      <title>Deployment of SQL Express LocalDB on IIS</title>
      <link>https://docs.microsoft.com/archive/blogs/gaurav/deployment-of-sql-express-localdb-on-iis</link>
      <pubDate>Sat, 21 Dec 2013 05:19:00 GMT</pubDate>
      <dc:creator><![CDATA[Gaurava K Arya]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/gaurav/2013/12/21/deployment-of-sql-express-localdb-on-iis/</guid>
      <description><![CDATA[This blog might be helpful if you are planning to deploy or have deployed LocalDB on the IIS server...]]></description>
      <content:encoded><![CDATA[<blockquote> <p><font size="2">This blog might be helpful if you are planning to deploy or have deployed LocalDB on the IIS server and running into issues. In recent times, we have been using SQL Express with ASP.NET websites as a light weight version of SQL Server when we don’t need enterprise level features. If you noticed the title of the blog i have written <strong>SQL Express LocalDB, </strong>so questions are what is <strong>SQL Express LocalDB? and </strong> how is it different from SQL Express?</font></p> <p><font size="2"></font>&nbsp;</p> <p><font size="4">What is LocalDB?</font></p> <p><font size="2">Let’s first talk about LocalDB. <strong>SQL Server Express</strong> <strong>LocalDB</strong> is a<strong> lightweight version of SQL Server</strong> that you can think of in many of the same ways as a SQL Server database. SQL Server Express LocalDB runs in user mode and you can install it more quickly since it requires no configuration. LocalDB is created specifically for developers and It is very easy to install and requires no management. It offers the same T-SQL language, programming surface and client-side providers as the regular SQL Server Express. Developers don’t want to concentrate on the management part of the SQL server rather they just want to concentrate on programming part and business logic. So If there is no need of other features of full version of SQL Server, you can continue using SQL Server Express or LocalDB in the production environment as well. </font></p> <p><font size="2">We can connect to localDB by specifying <strong>(localdb)\v11.0</strong> in server name. Here is how it would look in Sql Server Management Studio after connecting to the LocalDB database. </font></p> <p><br>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/8802.image_14766C48.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/8802.image_5F00_14766C48.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/3386.image_thumb_536A7D94.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/3386.image_5F00_thumb_5F00_536A7D94.png" width="423" height="323"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/8424.image_16045BD1.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/8424.image_5F00_16045BD1.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/4527.image_thumb_44E99E66.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/4527.image_5F00_thumb_5F00_44E99E66.png" width="496" height="318"></a>&nbsp; </p> <p><font size="2">Now there is a confusion. What is difference between SQL Express and SQL Express LocalDB? LocalDB is not a replacement for SQL Express rather it is just an addition to SQL Server Express lineup. While LocalDB is meant for developers, SQL Server Express is still a free SQL Server edition and is easily upgradeable to higher SQL Server editions. </font></p> <p><font size="2">If we talk about the differences at the core level than as such there is no difference. LocalDB is yet another instance of the same SQL server executable sqlservr.exe and it can be found at following path <strong>C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\ .</strong> This path will be different depending on the version of the SQL Express installed.&nbsp; </font></p> <p><font size="2">You can think of that localDB is launched by running the following given command. </font></p></blockquote> <blockquote><pre><strong><font size="2" face="Trebuchet MS">sqlservr.exe -m -s LocalDB</font></strong></pre><pre><font size="2"><font face="Trebuchet MS"></font></font>&nbsp;</pre><pre><font size="2"><font face="Trebuchet MS">For that matter, we can use same command to run the sqlservr.exe as a different instance name like <strong>“SQLExpress” </strong>or “<strong>localDB</strong>” or <strong>“GauravDB” </strong>etc. In the above command, “–m” switch makes sure that this instance in running in <strong>single user mode</strong>. For more understanding </font></font></pre><pre><font size="2"><font face="Trebuchet MS">on this command, please </font></font><font size="2"><font face="Trebuchet MS">refer to this article<font color="#0000ff"> </font></font></font><a href="http://technet.microsoft.com/en-us/library/ms180965(v=sql.105).aspx"><font color="#0000ff" size="2" face="Trebuchet MS">How to: Start an Instance of SQL Server (sqlservr.exe)</font></a> </pre><pre>&nbsp;</pre><pre><font size="2" face="Trebuchet MS">For using LocalDB in ASP.NET application, like a normal SQL Server connection string, we just need to specify 4 basic required settings, ServerName, DatabaseName, UserName  </font><font size="2" face="Trebuchet MS">and Password. I used following connection string in my application. For understanding the difference </font></pre><pre><font size="2" face="Trebuchet MS">I have specified connection strings for LocalDB and SQLExpress respectively with that of LocalDB in bold. </font><font size="2" face="Trebuchet MS">So we can see that there is as such no difference in both the connection </font><font size="2" face="Trebuchet MS">strings except the instance name. </font></pre></blockquote>
<blockquote><pre class="code"><font size="2"><font face="Trebuchet MS"><span style="background: white; color: blue"> &lt;</span><span style="background: white; color: #a31515">connectionStrings</span></font></font><font size="2"><font face="Trebuchet MS"><span style="background: white; color: blue">&gt;
 <strong>  </strong></span></font></font></pre><pre class="code"><font size="2"><font face="Trebuchet MS"><span style="background: white; color: blue"><strong>  &lt;</strong></span><strong><span style="background: white; color: #a31515">add </span><span style="background: white; color: red">name</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">LocalDBConnection</span><span style="background: white; color: black">" </span><span style="background: white; color: red">connectionString</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">Data Source=(LocalDB)\V11.0;Initial Catalog=SampleLocalDB;Integrated Security=SSPI;</span></strong></font></font></pre><pre class="code"><font size="2"><font face="Trebuchet MS"><strong><span style="background: white; color: blue">    AttachDbFilename=|DataDirectory|\SampleLocalDB.mdf</span><span style="background: white; color: black">" </span><span style="background: white; color: red">providerName</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">System.Data.SqlClient</span><span style="background: white; color: black">" </span></strong></font></font><font size="2"><font face="Trebuchet MS"><span style="background: white; color: blue"><strong>/&gt;
 </strong>   </span></font></font></pre><pre class="code"><font size="2"><font face="Trebuchet MS"><span style="background: white; color: blue">    &lt;</span><span style="background: white; color: #a31515">add </span><span style="background: white; color: red">name</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">SQLExpressConnection</span><span style="background: white; color: black">" </span><span style="background: white; color: red">connectionString</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">Data Source.\SQLEXPRESS;Initial Catalog=SampleEXPRESSDB;Integrated Security=SSPI;</span></font></font></pre><pre class="code"><font size="2"><font face="Trebuchet MS"><span style="background: white; color: blue">    AttachDbFilename=|DataDirectory|\SampleLocalDB.mdf</span><span style="background: white; color: black">" </span><span style="background: white; color: red">providerName</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">System.Data.SqlClient</span><span style="background: white; color: black">" </span></font></font><font size="2"><font face="Trebuchet MS"><span style="background: white; color: blue">/&gt;
    </span></font></font></pre><pre class="code"><font size="2"><font face="Trebuchet MS"><span style="background: white; color: blue"> </span></font></font><font size="2"><font face="Trebuchet MS"><span style="background: white; color: blue">  &lt;/</span><span style="background: white; color: #a31515">connectionStrings</span><span style="background: white; color: blue">&gt;</span></font></font></pre><a href="http://11011.net/software/vspaste"></a>
<p><font size="2">&nbsp;</font></p>
<p><font size="4">Deploying LocalDB on IIS Server</font>&nbsp;</p>

</blockquote>
<blockquote>
<p><font size="2">We can use simply localDB in our web application just like any other database but when we deploy our application on the IIS Server, we may see following error message when using LocalDB on IIS web server.</font></p></blockquote>
<blockquote>
<p><i><font size="2">A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details. <br>)</font></i></p></blockquote>
<blockquote>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/6114.image_64BFB434.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/6114.image_5F00_64BFB434.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/7360.image_thumb_16E12176.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/7360.image_5F00_thumb_5F00_16E12176.png" width="931" height="516"></a> </p>
<p><font size="2"></font>&nbsp;</p>
<p><font size="2">Actually, we see above error when application is not able to find the database i.e. database is not reachable. So what is happening here? You would have noticed one thing while discussing about LocalDB database. I said LocalDB runs in user mode and here is the key in this statement. Now if you will check Windows application event logs, we can see following logs there.</font></p></blockquote>
<blockquote>
<p><strong><font size="2">Windows API call SHGetKnownFolderPath returned error code: 5. Windows system error message is: Access is denied. <br>Reported at line: 401. </font></strong></p></blockquote>
<blockquote>
<p><strong><font size="2">Cannot get a local application data path. Most probably a user profile is not loaded. If LocalDB is executed under IIS, make sure that profile loading is enabled for the current user.</font></strong></p><strong></strong></blockquote>
<blockquote>
<p><font size="2">Second event log is self explanatory that we require to load the profile settings for the IIS worker process. Now only setting <span style="background: white; color: red">loadUserProfile</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">true</span><span style="background: white; color: black">"</span>&nbsp; will not help and we will also require to set <span style="background: white; color: red">setProfileEnvironment</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">true</span><span style="background: white; color: black">". So our application pool settings should look like following.</span></font></p>
<p><span style="background: white; color: black"></span>&nbsp;</p><pre class="code"><font size="2"><font face="Trebuchet MS"><span style="background: white; color: blue"> &lt;</span><span style="background: white; color: #a31515">add </span><span style="background: white; color: red">name</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">DefaultAppPool</span><span style="background: white; color: black">"</span></font></font><font size="2"><font face="Trebuchet MS"><span style="background: white; color: blue">&gt;
        &lt;</span><span style="background: white; color: #a31515">processModel </span><span style="background: white; color: red">identityType</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">ApplicationPoolIdentity</span><span style="background: white; color: black">" </span><span style="background: white; color: red">loadUserProfile</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">true</span><span style="background: white; color: black">" </span><span style="background: white; color: red">setProfileEnvironment</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">true</span><span style="background: white; color: black">" </span></font></font><font size="2"><font face="Trebuchet MS"><span style="background: white; color: blue">/&gt;
 &lt;/</span><span style="background: white; color: #a31515">add</span><span style="background: white; color: blue">&gt;</span></font></font></pre><pre class="code"><span style="background: white; color: blue"><font size="2"><font color="#000000" face="Trebuchet MS">If you need more details about this issue you would like to go through these blogs which provides much more details about this particular issue. </font></font></span></pre><pre class="code"><span style="background: white; color: blue"><a title="http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-1-user-profile.aspx" href="http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-1-user-profile.aspx"><font color="#0000ff" size="2" face="Trebuchet MS">http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-1-user-profile.aspx</font></a></span></pre><pre class="code"><a title="http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-2-instance-ownership.aspx" href="http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-2-instance-ownership.aspx"><font color="#0000ff" size="2" face="Trebuchet MS">http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-2-instance-ownership.aspx</font></a></pre><pre class="code">&nbsp;</pre></blockquote>
<blockquote><pre class="code"><font size="2" face="Trebuchet MS">Here are some other related blogs which can help you in understanding more about LocalDB.</font></pre></blockquote>
<blockquote><a href="http://11011.net/software/vspaste"></a>
<p><font size="2">Local Data Overview </font><a title="http://msdn.microsoft.com/en-us/library/ms233817.aspx" href="http://msdn.microsoft.com/en-us/library/ms233817.aspx"><font color="#0000ff" size="2">http://msdn.microsoft.com/en-us/library/ms233817.aspx</font></a></p>
<p><font size="2">SQL Server 2012 Express LocalDB<font color="#0000ff"> </font></font><a title="http://technet.microsoft.com/en-us/library/hh510202.aspx" href="http://technet.microsoft.com/en-us/library/hh510202.aspx"><font color="#0000ff" size="2">http://technet.microsoft.com/en-us/library/hh510202.aspx</font></a></p>
<p><font size="2">Introducing LocalDB, an improved SQL Express<font color="#0000ff"> </font></font><a title="http://blogs.msdn.com/b/sqlexpress/archive/2011/07/12/introducing-localdb-a-better-sql-express.aspx" href="http://blogs.msdn.com/b/sqlexpress/archive/2011/07/12/introducing-localdb-a-better-sql-express.aspx"><font color="#0000ff" size="2">http://blogs.msdn.com/b/sqlexpress/archive/2011/07/12/introducing-localdb-a-better-sql-express.aspx</font></a></p>
<p><font size="2">LocalDB: Where is My Database? </font><a title="http://blogs.msdn.com/b/sqlexpress/archive/2011/10/28/localdb-where-is-my-database.aspx" href="http://blogs.msdn.com/b/sqlexpress/archive/2011/10/28/localdb-where-is-my-database.aspx"><font color="#0000ff" size="2">http://blogs.msdn.com/b/sqlexpress/archive/2011/10/28/localdb-where-is-my-database.aspx</font></a> <br></p></blockquote>
<p>&nbsp;</p>
<blockquote><pre class="code"><span style="background: white; color: blue"><font color="#000000" size="2" face="Trebuchet MS">Hope it helps. Please let me know the feedback. </font></span></pre><pre class="code"><span style="background: white; color: blue"><font color="#000000" size="2" face="Trebuchet MS">Thanks</font></span></pre></blockquote>]]></content:encoded>
    </item>
    <item>
      <title>Encrypting section of config file using aspnet_regiis.exe - The configuration for physical path ‘*web.config' cannot be opened.</title>
      <link>https://docs.microsoft.com/archive/blogs/gaurav/encrypting-section-of-config-file-using-aspnet_regiis-exe-the-configuration-for-physical-path-web-config-cannot-be-opened</link>
      <pubDate>Sun, 15 Dec 2013 18:33:00 GMT</pubDate>
      <dc:creator><![CDATA[Gaurava K Arya]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/gaurav/2013/12/15/encrypting-section-of-config-file-using-aspnet_regiis-exe-the-configuration-for-physical-path-web-config-cannot-be-opened/</guid>
      <description><![CDATA[&nbsp;  We are already aware that The ASP.NET IIS Registration tool (Aspnet_regiis.exe) is used to...]]></description>
      <content:encoded><![CDATA[<p><font face="Calibri">&nbsp;</font></p> <p><font face="Calibri"></font></p> <h4><font face="Calibri">We are already aware that The ASP.NET IIS Registration tool (</font><a href="http://msdn.microsoft.com/en-us/library/k6h9cz8h%28v=vs.100%29.aspx"><font face="Calibri">Aspnet_regiis.exe</font></a><font face="Calibri">) is used to register ASP.NET applications with Internet Information Services (IIS). It provides us with some other features as well and maximum of them are on its MSDN article. One such feature is encryption of config file sections and that is obviously for security reasons. Here is an MSDN article </font><a href="http://msdn.microsoft.com/en-us/library/ff647398.aspx"><font face="Calibri">How To: Encrypt Configuration Sections in ASP.NET 2.0 Using DPAPI</font></a><font face="Calibri"> which focuses on this feature. </font></h4> <h4><font face="Calibri">Now, purpose of writing this blog is to put some light on this feature and also pointing out one common mistake while using this feature.</font></h4><font size="3"></font> <h4><font face="Calibri">&nbsp;</font></h4> <h4><font face="Calibri">1. We will look when can we get error like “The configuration for physical path ‘*\web.config' cannot be opened.”</font></h4> <h4><font face="Calibri">2. Using this feature for encryption of config sections of windows/console application’s configuration file i.e. app.config</font></h4> <p><font face="Calibri">&nbsp;</font></p> <h4><strong><font size="4" face="Calibri">1. “The configuration for physical path ‘web.config' cannot be opened”</font></strong></h4> <p><font face="Calibri">&nbsp;</font></p> <h4><font face="Calibri">Maximum time this error occurs because of <strong>incorrect path of the config file</strong>. But in this case when we check the path, it seems that we have correct path. If you will closely look at the command again, you will find a difference from the one mentioned in the above </font><a href="http://msdn.microsoft.com/en-us/library/ff647398.aspx"><font face="Calibri">MSDN article</font></a><font face="Calibri">. So here is your command</font></h4> <h4><font face="Calibri">C:\Windows\Microsoft.NET\Framework64\v4.0.30319&gt;aspnet_regiis.exe -pef "appSettings" "C:\inetpub\wwwroot\testweb\web.config" -prov "DataProtectionConfigurationProvider" </font></h4> <h4><font face="Calibri">Microsoft (R) ASP.NET RegIIS version 4.0.30319.33440 </font></h4> <h4><font face="Calibri">Administration utility to install and uninstall ASP.NET on the local machine. </font></h4> <h4><font face="Calibri">Copyright (C) Microsoft Corporation.&nbsp; All rights reserved. </font></h4> <h4><font face="Calibri">Decrypting configuration section... </font></h4> <h4><font face="Calibri">The configuration for physical path 'C:\inetpub\wwwroot\testweb\web.config' cannot be opened. </font></h4> <h4><font face="Calibri">Failed!</font></h4> <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/4848.image_0806A620.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/4848.image_5F00_0806A620.png"><font face="Calibri"><img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/7558.image_thumb_250F54E8.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/7558.image_5F00_thumb_5F00_250F54E8.png" width="1085" height="207"></font></a><font face="Calibri"> </font></p> <p><font face="Calibri">&nbsp;</font></p> <p><font size="3" face="Calibri"></font></p> <h4><font face="Calibri">Did you find the difference? yes there is “web.config” specified in the command. Of course, we should specify the file name which we are targeting for encryption. But hold on, remember Aspnet_regiis.exe is only meant for websites and one more thing that there can be only one web.config file inside any folder. Even if it is web1.config, its of no use because ASP.NET engine is not going to read it. So what’s the point. </font></h4> <h4><font face="Calibri">Point is that Aspnet_regiis.exe implicitly considers that specified path has web.config file and it will encrypt the specified section of that file. So you have to just specify “'C:\inetpub\wwwroot\testweb” and web.config will </font></h4> <h4><font face="Calibri">be added by this tool automatically. If web.config file does not exist inside the folder it will create an empty web.config file and empty section inside it and then will encrypt it(Give it a try). Command should look like following</font></h4><font size="3" face="Calibri">&nbsp;&nbsp;&nbsp; </font> <h4><strong><font face="Calibri">C:\Windows\Microsoft.NET\Framework64\v4.0.30319&gt;aspnet_regiis.exe -pef "appSettings" "C:\inetpub\wwwroot\testweb" -prov "DataProtectionConfigurationProvider"</font></strong></h4><font size="3" face="Calibri">&nbsp;&nbsp;&nbsp; </font> <h4><font face="Calibri">Same thing applies while decryption as well and command should be like this </font></h4> <h4><font face="Calibri">C:\Windows\Microsoft.NET\Framework64\v4.0.30319&gt;aspnet_regiis.exe -pdf "appSettings" "C:\inetpub\wwwroot\testweb"</font></h4><font size="3" face="Calibri">&nbsp;&nbsp;&nbsp; </font> <h4><strong>2. Using this feature for encryption of config sections of windows/console application’s configuration file i.e. app.config</strong></h4><font size="3" face="Calibri">&nbsp;&nbsp;&nbsp; </font> <h4><font face="Calibri">Now question is how do we encrypt section of </font><a href="http://blogs.msdn.com/b/suzcook/archive/2003/06/02/57160.aspx"><font face="Calibri">app.config</font></a><font face="Calibri"> file if aspnet_regiis.exe only looks for web.config file and after building app.config files have the naming convention of&nbsp; AppTitle.exe.config</font></h4><font size="3" face="Calibri">&nbsp;&nbsp;&nbsp; </font> <h4><font face="Calibri">Here is the screen shot of one such windows application with a configuration file SampleApp.exe.config.</font></h4><font face="Calibri">&nbsp;&nbsp;&nbsp;&nbsp; </font> <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/2046.image_79611B9C.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/2046.image_5F00_79611B9C.png"><font face="Calibri"><img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/7360.image_thumb_5AAA31B1.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/7360.image_5F00_thumb_5F00_5AAA31B1.png" width="710" height="154"></font></a><font face="Calibri"> </font></p> <p><font face="Calibri">&nbsp;</font></p> <p><font face="Calibri"></font></p> <div id="codeSnippetWrapper"> <div id="codeSnippet" class="csharpcode"> <h4><font face="Calibri">Following is the content from the configuration file where you can see i have some sensitive database information which we do not want to expose to users of the client’s computer. </font></h4><span class="kwrd"></span> <p><font face="Calibri">&nbsp;</font></p><pre class="code"><span style="background: white; color: blue">&lt;?</span><span style="background: white; color: #a31515">xml </span><span style="background: white; color: red">version</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">1.0</span><span style="background: white; color: black">" </span><span style="background: white; color: red">encoding</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">utf-8</span><span style="background: white; color: black">" </span><span style="background: white; color: blue">?&gt;
&lt;</span><span style="background: white; color: #a31515">configuration</span><span style="background: white; color: blue">&gt;
  &lt;</span><span style="background: white; color: #a31515">startup</span><span style="background: white; color: blue">&gt;
    &lt;</span><span style="background: white; color: #a31515">supportedRuntime </span><span style="background: white; color: red">version</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">v4.0</span><span style="background: white; color: black">" </span><span style="background: white; color: red">sku</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">.NETFramework,Version=v4.5</span><span style="background: white; color: black">" </span><span style="background: white; color: blue">/&gt;
  &lt;/</span><span style="background: white; color: #a31515">startup</span><span style="background: white; color: blue">&gt;
  &lt;</span><span style="background: white; color: #a31515">appSettings</span><span style="background: white; color: blue">&gt;
    &lt;</span><span style="background: white; color: #a31515">add </span><span style="background: white; color: red">key</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">sConnectionString</span><span style="background: white; color: black">" </span><span style="background: white; color: red">value</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">Provider=SQLOLEDB;Data Source=Your_Server_Name;Initial Catalog=Your_Database_Name;User Id=Your_Username;Password=Your_Password;</span><span style="background: white; color: black">" </span><span style="background: white; color: blue">/&gt;
  &lt;/</span><span style="background: white; color: #a31515">appSettings</span><span style="background: white; color: blue">&gt;
&lt;/</span><span style="background: white; color: #a31515">configuration</span><span style="background: white; color: blue">&gt;</span></pre><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a>


<p><font face="Calibri">&nbsp;</font></p>

</div></div>


<h4><strong><font face="Calibri">As we are aware of this limitation of aspnet_regiis.exe, we can find a workaround for this. Let’s fool aspnet_regiis.exe, what if we rename SampleApp.exe.config as web.config :)</font></strong></h4><font size="3" face="Calibri">&nbsp;&nbsp;&nbsp; </font>
<h5><font face="Calibri">C:\Windows\Microsoft.NET\Framework64\v4.0.30319&gt;<strong>rename</strong> E:\SampleApp\SampleApp\SampleApp\bin\Release\SampleApp.exe.config <strong>web.config</strong></font></h5>
<h5><font face="Calibri">C:\Windows\Microsoft.NET\Framework64\v4.0.30319&gt;aspnet_regiis.exe -pef "appSettings" E:\SampleApp\SampleApp\SampleApp\bin\Release -prov DataProtectionConfigurationProvider</font></h5>
<h5><font face="Calibri">C:\Windows\Microsoft.NET\Framework64\v4.0.30319&gt;<strong>rename </strong>web.config E:\SampleApp\SampleApp\SampleApp\bin\Release\<strong>SampleApp.exe.config</strong></font></h5>
<h4><font size="2" face="Calibri">&nbsp;</font></h4>
<h4><font face="Calibri">Here is the screen shot of encrypted config file. So final step is to rename it back to the SampleApp.exe.config </font></h4><pre class="code">&nbsp;</pre>
<div id="codeSnippetWrapper">
<div id="codeSnippet" class="csharpcode"><pre class="code"><span style="background: white; color: blue">&lt;?</span><span style="background: white; color: #a31515">xml </span><span style="background: white; color: red">version</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">1.0</span><span style="background: white; color: black">" </span><span style="background: white; color: red">encoding</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">utf-8</span><span style="background: white; color: black">" </span><span style="background: white; color: blue">?&gt;
&lt;</span><span style="background: white; color: #a31515">configuration</span><span style="background: white; color: blue">&gt;
  &lt;</span><span style="background: white; color: #a31515">startup</span><span style="background: white; color: blue">&gt;
    &lt;</span><span style="background: white; color: #a31515">supportedRuntime </span><span style="background: white; color: red">version</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">v4.0</span><span style="background: white; color: black">" </span><span style="background: white; color: red">sku</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">.NETFramework,Version=v4.5</span><span style="background: white; color: black">" </span><span style="background: white; color: blue">/&gt;
  &lt;/</span><span style="background: white; color: #a31515">startup</span><span style="background: white; color: blue">&gt;
  &lt;</span><span style="background: white; color: #a31515">appSettings </span><span style="background: white; color: red">configProtectionProvider</span><span style="background: white; color: blue">=</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">DataProtectionConfigurationProvider</span><span style="background: white; color: black">"</span><span style="background: white; color: blue">&gt;
    &lt;</span><span style="background: white; color: #a31515">EncryptedData</span><span style="background: white; color: blue">&gt;
      &lt;</span><span style="background: white; color: #a31515">CipherData</span><span style="background: white; color: blue">&gt;
        &lt;</span><span style="background: white; color: #a31515">CipherValue</span><span style="background: white; color: blue">&gt;
          </span><span style="background: white; color: black">AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAVPxdfgBHA02++GKp0N/yYgQAAAACAAAAAAADZgAAwAAAABAAAADZaWlaU2XHAEquSvyREPJWAAAAAASAAACgAAAAEAAAAPbsjf6iKY3mQ0duO6Hk0mSY
          AQAAiwBI8J7lX73foO39YqjhtaSZ5H+e+h0Oc4vgzc2Eegkx1Ch67MBIFek7LhEtMKN06YVWw/lTdc+llLcjcjPfzvieupil2fOLZDAc6CSbTXItunMyhJWu3vlW+O/HPTtowq/c6Hz6TzryInBAxyX8ZBLRaFOU3
          JwhcjwEVoqWRZGNryO8sE5ntHEFatgiTh7pPvqtfMqd0UZz2lWWd+r/xJIr5ig6kfORkKE/plvATpey8zmTQNrxQx1v/dELislsBURDSHAmrL7CIDkbg5tQmj9cHtBh7BSUFHrK8JtCSPbTbUHVU4lcfbjMIrZ/1q
          inc0o0RTfhwusH+KLjSWb224E2ycxm3jubDM35dtZaGPrKCYpZS6KhaX4IVMFr5RMbdK+sJj4JLtN7O2kosM8nmYhPs+P0SUsBeJ117beE7egk5CWt7LdGXIAaRtdfEJVBFXWc5OKQGJQGWJVRPDslxgA/hviXk6y
          uPWS5gEc1aY+iSRAaqO+53nAEBvlurYrCp1MqjE75pTL56kcOrpYET89VN6dcDPWGFAAAALHIG4IJ0+C+oE9TkcY55KxCFkD6
        </span><span style="background: white; color: blue">&lt;/</span><span style="background: white; color: #a31515">CipherValue</span><span style="background: white; color: blue">&gt;
      &lt;/</span><span style="background: white; color: #a31515">CipherData</span><span style="background: white; color: blue">&gt;
    &lt;/</span><span style="background: white; color: #a31515">EncryptedData</span><span style="background: white; color: blue">&gt;
  &lt;/</span><span style="background: white; color: #a31515">appSettings</span><span style="background: white; color: blue">&gt;
&lt;/</span><span style="background: white; color: #a31515">configuration</span><span style="background: white; color: blue">&gt;</span></pre><a href="http://11011.net/software/vspaste"></a></div></div>
<p><strong><font face="Calibri"></font></strong></p>
<p><font face="Calibri"></font></p>
<h4><font size="2" face="Calibri"></font></h4>
<h4><font size="2" face="Calibri"></font></h4>
<h4><font face="Calibri">Hope you like it! </font></h4>
<h4><font face="Calibri">Please let me know if there is any concerns or queries.</font></h4><font size="3" face="Calibri">&nbsp; </font>
<h4><font face="Calibri">Thanks</font></h4>
<h4><font face="Calibri">Gaurav</font></h4>
<p><font face="Calibri"></font></p>]]></content:encoded>
    </item>
    <item>
      <title>Web Farm Framework: “Routing rules” is not visible</title>
      <link>https://docs.microsoft.com/archive/blogs/gaurav/web-farm-framework-routing-rules-is-not-visible</link>
      <pubDate>Sun, 15 Dec 2013 02:06:49 GMT</pubDate>
      <dc:creator><![CDATA[Gaurava K Arya]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/gaurav/2013/12/15/web-farm-framework-routing-rules-is-not-visible/</guid>
      <description><![CDATA[I am writing this blog to shed some details on Routing Rules and to point out a scenario which you...]]></description>
      <content:encoded><![CDATA[<p>I am writing this blog to shed some details on Routing Rules and to point out a scenario which you may run into. Recently, I found one of the case with one customer where Routing Rules icon was not visible when selected the Server farm.</p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/5633.image_57C38EB3.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/5633.image_5F00_57C38EB3.png"><img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/5670.image_thumb_09BDBFEF.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/5670.image_5F00_thumb_5F00_09BDBFEF.png" width="760" height="300" /></a> </p>  <p></p>  <p>&#160;</p>  <p><strong>You may see this issue if you are trying to configure Web Farm Framework from the scratch or you have accidently or intentionally uninstalled some item from control panel. </strong></p>  <p>&#160;</p>  <p>So first lets talk about Routing Rules. Routing Rules Page can be used to configure simple routing rules and if we need to create complex rules, we need to use UrlRewrite module itself. Here are some more details about the routing rules page at this article. <a title="http://technet.microsoft.com/en-us/library/dd443532(v=WS.10).aspx" href="http://technet.microsoft.com/en-us/library/dd443532(v=WS.10).aspx">http://technet.microsoft.com/en-us/library/dd443532(v=WS.10).aspx</a></p>  <p>&#160;</p>  <p>First as the above article says: “<strong><font size="3">Routing Rules feature is only enabled if the URL Rewrite module is installed</font>.” </strong>I installed UrlRewrite using the WebPI and here we can see that “Routing Rules” option is available here now.</p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/4466.image_147DA7F5.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/4466.image_5F00_147DA7F5.png"><img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/8623.image_thumb_4677D930.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/8623.image_5F00_thumb_5F00_4677D930.png" width="769" height="218" /></a> </p>  <p>&#160;</p>  <p>Now let’s try to change some settings in Routing Rules module:</p>  <p>&#160;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/1638.image_383BF0F1.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/1638.image_5F00_383BF0F1.png"><img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/6371.image_thumb_0E5B7CBC.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/6371.image_5F00_thumb_5F00_0E5B7CBC.png" width="775" height="412" /></a> </p>  <p>And this is what I see in the UrlRewrite module, a rule has been created corresponding to my changes. So whatever setting we apply using Routing Rules module, this is going to use the UrlRewrite module in the core and these changes will be saved in applicationHost.config file at this path %windir%\inetsrv\config</p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/6330.image_191B64C2.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/6330.image_5F00_191B64C2.png"><img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/61/53/metablogapi/3652.image_thumb_563F2047.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-61-53-metablogapi/3652.image_5F00_thumb_5F00_563F2047.png" width="1063" height="344" /></a> </p>  <p>&#160;</p>  <p>And here is the rule taken from the applicationHost.config file. </p>  <p>&#160;</p>  <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;rewrite&gt;   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;globalRules&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;rule name=&quot;ARR_Farm-External_loadbalance&quot; enabled=&quot;true&quot; patternSyntax=&quot;Wildcard&quot; stopProcessing=&quot;true&quot;&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;match url=&quot;*&quot; /&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;conditions&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;add input=&quot;{URL}&quot; pattern=&quot;Images&quot; negate=&quot;true&quot; /&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/conditions&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;action type=&quot;Rewrite&quot; url=&quot;<a href="http://Farm-External/{R:0}&quot;">http://Farm-External/{R:0}&quot;</a> /&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/rule&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/globalRules&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/rewrite&gt;</p>  <p>&#160;</p>  <p>So we can see that rule is saved in rewrite tags. Routing Rules page is actually just a UI provided to create simple rule for WFF in IIS. </p>  <p>Hope this helps, please let me know the feedback.</p>]]></content:encoded>
    </item>
  </channel>
</rss>