<?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>WebTopics</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/webtopics/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/webtopics/feed.xml</link>
    <description>IIS and ASP.NET Information and Tips from Microsoft Developer Support</description>
    <lastBuildDate>Thu, 16 Aug 2018 12:16:30 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>IIS on Nano server in a Hyper-V Virtual machine</title>
      <link>https://docs.microsoft.com/archive/blogs/webtopics/iis-on-nano-server-in-a-hyper-v-virtual-machine</link>
      <pubDate>Thu, 16 Aug 2018 12:16:30 GMT</pubDate>
      <dc:creator><![CDATA[Naveen Baliga]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/webtopics/?p=1735</guid>
      <description><![CDATA[This blog talks about setting up the IIS on nano server as a guest OS for the Hyper-V virtual...]]></description>
      <content:encoded><![CDATA[This blog talks about setting up the IIS on nano server as a guest OS for the Hyper-V virtual machine. I shall write another blog on running my website on Nano within a container.

Before I get into installing IIS on Nano server in my hyper-V, let us get some background on Nano Server.

<span style="text-decoration: underline"><strong>Nano Server:
</strong></span>
<ul>
 	<li>Nano server is available with Windows Server 2016</li>
 	<li>This installation option is available for Standard and Datacenter editions of Server 2016.</li>
 	<li>It doesn't have the *FULL* .Net Framework installed.</li>
 	<li>It is similar to Windows Server Core, but significantly smaller, lighter, has no local logon capability, headless and only supports 64-bit applications and tools.</li>
 	<li>It is a remotely administered server operating system optimized for private clouds and datacenters.</li>
 	<li>It can be used as a DNS, File storage host, IIS web server to host the application which doesn't need full .net framework. It ideal to be used in a container or as a guest OS in virtual machine. It can also run on physical box.</li>
 	<li>It takes up far less disk space, sets up significantly faster, and requires far fewer updates and restarts than Windows Server.</li>
</ul>
&nbsp;

<span style="text-decoration: underline"><strong>Difference between Server Core and Nano Server:
</strong></span>

<strong>Server Core:
</strong>
<ul>
 	<li>Introduced with server 2008 R2</li>
 	<li>Has powershell / cmd to help us in the remote administrative management</li>
 	<li>GUI can be added if need be using install-windowsFeature</li>
 	<li>supports RDP</li>
</ul>
<strong>Nano Server:
</strong>
<ul>
 	<li>This is not exactly same as server core. This is headless. Meaning there is no logon capability and No GUI option.</li>
 	<li>It can be only operated remotely.</li>
 	<li>It has fixed set of roles which can be installed.</li>
 	<li>It is best for a container / hyper V server. It doesn't support installing the full version of .Net framework. But only a subset of the .net Fx (.net core) which was written specifically for the cloud and cross platform.</li>
</ul>
<span style="text-decoration: underline"><strong>Note:</strong></span> Both run on physical and VM. Both run on the container. The dotnet core application which run on nano can run on server core too.

&nbsp;

<span style="text-decoration: underline"><strong>Creating the nano VHD:
</strong></span>

I will be using a 180 day free trial ISO downloaded from the Evaluation Center site: <a href="https://www.microsoft.com/evalcenter/evaluate-windows-server-2016">https://www.microsoft.com/evalcenter/evaluate-windows-server-2016</a>

Then follow the below steps in order:

1. Extract the ISO and you should be having it in your storage drive. I had it inside my F:\ drive

2. I created a sample folder C:\Nano\ and placed the NanoServerImageGenerator folder from the F:\NanoServer folder which we extracted in Step 1

3. Start Windows PowerShell as an administrator, Navigate to the folder C:\Nano\NanoServerImageGenerator\ and run the powershell command: <strong>Import-Module .\NanoServerImageGenerator.psm1 -Verbose
</strong>

4. After this, you need to run the below command to create a nano server VHD which can be imported as a Guest OS in our Hyper V:

<strong>PS C:\nano&gt; New-NanoServerImage -edition Standard -MediaPath F:\ -BasePath C:\nano -targetPath C:\nano\nanodemo.vhdx -deploymentType Guest -Computername nanodemo -storage -Package Microsoft-NanoServer-IIS-Package
</strong>

<span style="color: black;background-color: white">This command copies the necessary files from media path F:\ drive into my base path C:\nano\. It converts the Nano Server <strong>.wim</strong> file into a <strong>.vhd</strong> file. It then moves the newly created standard edition of VHD to my target path. I have given my computer name as nanodemo and since I will be using it as a Guest OS, I have mentioned Guest in my deploymentType.
</span>

<span style="color: black;background-color: white">I am installing the IIS role using the <strong>-package</strong> switch while creating the VHD. Note that you can also install the IIS feature later, I will be explaining it later in this blog.
</span>

<span style="color: black;background-color: white">5. It will also prompt you for providing the <strong>administrator</strong> password. Remember this password and you are expected to provide this password while you login to your nano server.
</span>

&nbsp;

<span style="text-decoration: underline"><strong>Setting up the VM:
</strong></span>

I have installed the <strong>Hyper-V</strong> role in my Host machine.
<ol>
 	<li><span style="color: black;background-color: white">Open the Hyper-V Manager, On the right-side <strong>Actions</strong> Pane, click on the <strong>Virtual Switch Manager</strong> and create a virtual switch. I am making use of an Internal virtual Switch in my demo.
</span></li>
 	<li><span style="color: black;background-color: white">Click on New<span style="font-family: Wingdings">à</span> Virtual Machine<span style="font-family: Wingdings">à</span> Give a name to Your Virtual machine <span style="font-family: Wingdings">à</span> You can allocate some startup memory <span style="font-family: Wingdings">à</span> Assign the Virtual switch connection which you created in Step 1.
</span></li>
 	<li><span style="color: black;background-color: white">In the next step we can <strong>Use an existing Virtual hard disk</strong>
<span style="font-family: Wingdings">à</span> Point it to the Virtual hard disk ( vhd) which we created above.
</span></li>
 	<li><span style="color: black;background-color: white">This will take some time to setup the Guest nano OS. After this, your Virtual machine will be up and running.
</span></li>
 	<li>
<div><span style="color: black;background-color: white">You will be asked to login, use the same password which you had used while creating the vhd.
</span></div></li>
</ol>
<p style="text-align: center"><img src="https://msdnshared.blob.core.windows.net/media/2018/08/081618_1206_IISonNanose1.png" alt="" /><span style="color: black;background-color: white">
</span></p>
&nbsp;

<span style="color: black;background-color: white;text-decoration: underline"><strong>Configuring the Nano Server:
</strong></span>
<ol>
 	<li><span style="color: black;background-color: white">After your login, you will see Nano Server Recovery Console as shown below:
</span></li>
</ol>
<p style="text-align: center"><img src="https://msdnshared.blob.core.windows.net/media/2018/08/081618_1206_IISonNanose2.png" alt="" /><span style="color: black;background-color: white">
</span></p>

<ol>
 	<li><span style="color: black;background-color: white">You can enable the settings as per your requirement. Note: I have enabled the WinRM for remote management and enabled a few of the Inbound and outbound ports needed for my application.</span><span style="text-decoration: underline"><strong>
</strong></span></li>
 	<li>I have made a note of the IP address of my nano server from the Networking setting.</li>
 	<li>Since I mentioned that the nano server is headless, we will be making use of the powershell to access the nano server remotely.</li>
</ol>
&nbsp;

<span style="text-decoration: underline"><strong>Accessing nano server remotely:
</strong></span>
<ol>
 	<li>
<div>I am making use of the below powershell script to remotely login to the Nano server VM. <span style="background-color: yellow;text-decoration: underline"><strong>Note</strong></span>: I have an entry in the <strong>C:\Windows\System32\drivers\etc\hosts</strong> file to map the nanodemo with the IP address found from Networking setting in my nano server.<strong>
</strong></div>
<p style="background: white"><span style="color: orangered;font-family: Lucida Console;font-size: 9pt">$server<span style="color: darkgray">=<span style="color: darkred">"nanodemo"</span>
</span></span></p>
<p style="background: white"><span style="font-family: Lucida Console;font-size: 9pt"><span style="color: blue">Enter-PSSession  </span><span style="color: navy">-VMName  </span><span style="color: orangered">$server </span><span style="color: navy">-Credential </span><span style="color: blueviolet">administrator</span></span></p>
</li>
 	<li>
<p style="background: white"><span style="font-family: Lucida Console;font-size: 9pt"><span style="color: blueviolet"></span></span>The above command will prompt you to enter the administrator credentials. On successful login, the powershell is ready to accept your commands:<strong>
</strong></p>
[nanodemo]: PS C:\Users\administrator\Documents&gt;</li>
 	<li>If you haven't used the switch <strong>-Package Microsoft-NanoServer-IIS-Package</strong> while creating the nano VHD, you can also install the IIS remotely using the below commands:
<p style="background: white"><span style="color: blue;font-family: Lucida Console;font-size: 9pt">Install-PackageProvider NanoServerPackage
</span></p>
<p style="background: white"><span style="color: blue;font-family: Lucida Console;font-size: 9pt">Import-PackageProvider NanoServerPackage
</span></p>
<p style="background: white"><span style="color: blue;font-family: Lucida Console;font-size: 9pt">Install-NanoServerPackage -Name Microsoft-NanoServer-IIS-Package</span></p>
</li>
 	<li>
<p style="background: white"><span style="color: blue;font-family: Lucida Console;font-size: 9pt"></span>To see all the available packages on Nano server, you can use the command: <span style="color: blue;font-family: Lucida Console;font-size: 9pt">Find-NanoServerPackage</span></p>
</li>
</ol>
<span style="text-decoration: underline"><strong>Creating IIS website:
</strong></span>
<ol>
 	<li>We will be making use of the newly introduced <a href="https://docs.microsoft.com/en-us/iis/get-started/whats-new-in-iis-10/iisadministration-powershell-cmdlets"><strong>iisadministration</strong></a> module.</li>
 	<li>
<div style="background: white">Remotely create the folder structure needed for your website and place your application code in nano server. <strong>Note</strong>: If you want to make use of the SMB ( <a href="///\\nanodemo">\\nanodemo\</a> ) to access the nano server files remotely, ensure that the <strong>File and Remote sharing </strong>Firewall setting is enabled on nano server.</div>
<p style="background: white"><span style="font-family: Lucida Console;font-size: 9pt"><span style="color: blue">Import-Module  </span><span style="color: blueviolet">iisadministration
</span></span></p>
</li>
</ol>
<p style="background: white"><span style="font-family: Lucida Console;font-size: 9pt"><span style="color: blue">      New-IISSite </span><span style="color: navy">-Name </span><span style="color: blueviolet">samplesite </span><span style="color: navy">-BindingInformation </span><span style="color: darkred">"*:80:" </span><span style="color: navy">-PhysicalPath </span><span style="color: blueviolet">C:\inetpub\samplesite</span></span></p>
<p style="background: white">     3. After this you can access the website:</p>
<p style="text-align: center"><img src="https://msdnshared.blob.core.windows.net/media/2018/08/081618_1206_IISonNanose3.png" alt="" /></p>
<span style="text-decoration: underline"><strong>References</strong></span>:

<a href="https://docs.microsoft.com/en-us/windows-server/get-started/nano-server-quick-start">https://docs.microsoft.com/en-us/windows-server/get-started/nano-server-quick-start</a>

<a href="https://docs.microsoft.com/en-us/windows-server/get-started/getting-started-with-nano-server">https://docs.microsoft.com/en-us/windows-server/get-started/getting-started-with-nano-server</a>

<a href="https://docs.microsoft.com/en-us/windows-server/get-started/iis-on-nano-server">https://docs.microsoft.com/en-us/windows-server/get-started/iis-on-nano-server</a>

Hope this helps]]></content:encoded>
    </item>
    <item>
      <title>Securing the ARRAffinity Cookie</title>
      <link>https://docs.microsoft.com/archive/blogs/webtopics/securing-the-arraffinity-cookie</link>
      <pubDate>Mon, 14 May 2018 13:56:42 GMT</pubDate>
      <dc:creator><![CDATA[Priyanka Pai]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/webtopics/?p=1635</guid>
      <description><![CDATA[Usually when we talk about COOKIES the primary reason would be to manage state, handle logins etc....]]></description>
      <content:encoded><![CDATA[<strong>U</strong>sually when we talk about <a href="https://msdn.microsoft.com/en-us/library/ms178194.aspx">COOKIES</a> the primary reason would be to manage state, handle logins etc. So, it would be a quintessential property to keep it safe and to prevent any breach of security. Just like how we have a safe version of HTTP by encrypting over SSL, we can do the same for a cookie through the <strong>SECURE</strong> tag.

When we think of using the <a href="https://docs.microsoft.com/en-us/iis/extensions/configuring-application-request-routing-arr/define-and-configure-an-application-request-routing-server-farm">ARR</a> module in IIS for load balancing and enable server affinity , an additional tag(cookie) called ARR affinity will be assigned by the ARR to the first request of a new user session so that till all subsequent requests are served, the client talks to the same back-end server until the session gets expired. This “technique” is aptly called as the <strong>Cookie Insertion Method</strong> where the ARR acts like a proxy between the client and the server to intercept the requests so that it will attach/stick the session to a specific server addressed by the RESPONSE_SERVER_NAME.

While troubleshooting on an issue, I came across a vulnerability in which the penetration test read “<strong>Missing Secure Attribute In SSL Session Cookie</strong>” that basically means that we need to plug the <a href="https://msdn.microsoft.com/en-us/library/system.web.httpresponse.setcookie(v=vs.110).aspx">RESPONSE_SET_COOKIE</a> with a “<strong>secure</strong>” tag.

Out of the different Fields that we can modify in the RESPONSE, our primary concern here would be to change the outgoing content (cookie) from the server back to the client but with the ARRAffinity set to secure.

After pondering over the many options we have in IIS, a very feasible option would be to use the URL REWRITE Module in IIS to <a href="https://blogs.msdn.microsoft.com/benjaminperkins/2012/11/02/change-or-modify-a-response-header-value-using-url-rewrite/">Modify the Response Section through an Outbound Rule</a>. This would need you to add a simple rule (mentioned below) in the outbound section.
<pre>&lt;rewrite&gt;

 &lt;allowedServerVariables&gt;

    &lt;add name="REMOTE_USER" /&gt;

    &lt;/allowedServerVariables&gt;

    &lt;globalRules&gt;

           &lt;rule name="ADD YOUR RULE NAME" enabled="true" patternSyntax="Wildcard" stopProcessing="true"&gt;

           &lt;match url="*" /&gt;

           &lt;action type="Rewrite" url="http://SERVERFARMNAME/{R:0}" /&gt;

           &lt;/rule&gt;</pre>
<pre>     &lt;/globalRules&gt;

           &lt;outboundRules&gt;

           &lt;rule name=”ADD YOUR RULE NAME"&gt;

           &lt;match serverVariable="RESPONSE_Set_Cookie" pattern="ARRAffinity=(.*)" /&gt;

           &lt;action type="Rewrite" value="<strong>{R:0};secure</strong>" /&gt;

           &lt;/rule&gt;

           &lt;/outboundRules&gt;

&lt;/rewrite&gt;</pre>
&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>An error occurred : Failed to find any azure subscriptions for the current user</title>
      <link>https://docs.microsoft.com/archive/blogs/webtopics/an-error-occurred-failed-to-find-any-azure-subscriptions-for-the-current-user</link>
      <pubDate>Thu, 11 Jan 2018 16:00:14 GMT</pubDate>
      <dc:creator><![CDATA[Nikita Habib]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/webtopics/?p=1545</guid>
      <description><![CDATA[The BOTs registered under the dev.botframework.com are to be migrated to  Azure Bot service as the...]]></description>
      <content:encoded><![CDATA[The BOTs registered under the dev.botframework.com are to be migrated to  Azure Bot service as the dev.botframework.com will be retired on March 31, 2018.
Sometimes,while migrating from dev.botframework.com to azure Bot service, we are seeing the below error.

<a href="https://msdnshared.blob.core.windows.net/media/2018/01/firstiamge.png"><img src="https://msdnshared.blob.core.windows.net/media/2018/01/firstiamge.png" alt="" width="609" height="224" class="alignnone size-full wp-image-1546" /></a>

&nbsp;

This error occurs if the website , dev.botframework.com , is logged in with an account which do not have any Azure subscription .

&nbsp;

To overcome this issue , we can follow the below steps.

In the portal, dev.botframework.com,
1.Open <strong>My Bots</strong>

<a href="https://msdnshared.blob.core.windows.net/media/2018/01/second-image.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/01/second-image.jpg" alt="" width="875" height="287" class="alignnone wp-image-1556" /></a>

&nbsp;

2.Click on the bot that has to be migrated.

3.Navigate to settings tab.

<a href="https://msdnshared.blob.core.windows.net/media/2018/01/third-image.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/01/third-image.jpg" alt="" width="881" height="242" class="alignnone wp-image-1565" /></a>

In settings, under the Admin section we see owners.

&nbsp;

<a href="https://msdnshared.blob.core.windows.net/media/2018/01/fourth-image-e1515625825645.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2018/01/fourth-image-e1515625825645.jpg" alt="" width="881" height="446" class="alignnone wp-image-1575" /></a>

4.Add the owner/account which has Azure subscription in here.

5.Login back with the new owner , now you will be able to migrate the bot  to azure bot services without any issues.

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Deploy the ASPNET Core App on Linux and Capture Perfview traces</title>
      <link>https://docs.microsoft.com/archive/blogs/webtopics/deploy-the-aspnet-core-app-on-linux-and-capture-perfview-traces</link>
      <pubDate>Thu, 28 Dec 2017 14:30:09 GMT</pubDate>
      <dc:creator><![CDATA[Naveen Baliga]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/webtopics/?p=1535</guid>
      <description><![CDATA[My previous blog was specifically to capture the perfview traces for aspnet core MVC application on...]]></description>
      <content:encoded><![CDATA[<p style="text-align: justify"><span style="color: black">My previous <a href="https://blogs.msdn.microsoft.com/webtopics/2017/12/27/capturing-perfview-traces-for-aspnet-core-application/"><strong>blog</strong></a> was specifically to capture the <a href="https://www.microsoft.com/en-us/download/details.aspx?id=28567"><strong>perfview</strong></a> traces for aspnet core MVC application on a Windows box.
</span></p>
<p style="text-align: justify"><span style="color: black">The current blog targets capturing the perfview traces for aspnet core MVC application on a <span style="text-decoration: underline"><strong>LINUX</strong></span> box.
</span></p>
<span style="color: black;font-size: 14pt;text-decoration: underline"><strong>Pre-requisites:
</strong></span><span style="color: black">1. On the Windows Development Box ensure that you have the below components:
</span>
<ul style="margin-left: 54pt">
 	<li><span style="color: black"><span style="text-decoration: underline"><strong>putty.exe:</strong></span> This is used to connect to your Guest LINUX box
</span></li>
 	<li><span style="text-decoration: underline"><strong>pscp.exe<span style="color: black">:</span></strong></span> This is a command line application to securely transfer the files.</li>
</ul>
2. Have a LINUX Operating system with most recent release. I am making use of<span> Ubuntu 17.04 release for my demo.</span>

3. The ASPNET Core application with the logging enabled. More Info on enabling logging can be found here in my previous <a href="https://blogs.msdn.microsoft.com/webtopics/2017/12/27/capturing-perfview-traces-for-aspnet-core-application/"><strong>blog</strong></a>.

&nbsp;

Let's get started.

<strong><span style="text-decoration: underline">Step 1:</span> Installing the Dotnet Core SDK on Linux</strong>

1. Install the Dotnet Core SDK for Linux from <a href="https://www.microsoft.com/net/learn/get-started/linuxubuntu"><strong>this </strong></a>article

Then run the commands mentioned in the above article. Note that you need to run the command as per the product version. If you are not sure of the version, you can simply run the below command:
<div style="margin-left: 18pt">
<table style="border-collapse: collapse" border="0"><colgroup> <col style="width: 597px" /></colgroup>
<tbody valign="top">
<tr style="height: 72px">
<td style="padding-left: 7px;padding-right: 7px;border: solid 0.5pt">
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 10pt">navba@CoreLinuxDemo:~$ <span style="background-color: lime"><strong><em>lsb_release -a</em></strong></span>
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 10pt">No LSB modules are available.
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 10pt">Distributor ID: Ubuntu
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 10pt">Description: <span style="background-color: yellow">Ubuntu 17.04</span>
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 10pt">Release: 17.04
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 10pt">Codename: zesty</span></p>
</td>
</tr>
</tbody>
</table>
</div>
&nbsp;

2. Post adding dotnet product feed and installing dotnet SDK, you can test the installation by simply creating a sample .NET     MVC application using the dotnet CLI. We are creating the app within the myapp directory.

<span style="font-family: Courier New;font-size: 10pt">      navba@CoreLinuxDemo:~$ <strong><em><span style="background-color: lime">dotnet new mvc -o myapp</span>
</em></strong></span>

To see the contents / files the above command gave you, run the below commands:
<div style="margin-left: 18pt">
<table style="border-collapse: collapse" border="0"><colgroup> <col style="width: 604px" /></colgroup>
<tbody valign="top">
<tr style="height: 57px">
<td style="padding-left: 7px;padding-right: 7px;border: solid 0.5pt">
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 10pt">navba@CoreLinuxDemo:~$ <span style="background-color: lime"><strong><em>cd myapp</em></strong></span>
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 10pt">navba@CoreLinuxDemo:~/myapp$ <span style="background-color: lime"><strong><em>ls</em></strong></span>
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt">appsettings.Development.json appsettings.json bower.json bundleconfig.json Controllers Models myapp.csproj obj Program.cs Startup.cs Views wwwroot</span></p>
</td>
</tr>
</tbody>
</table>
&nbsp;

3. To restore the dependencies of your application, you can run the below command:

</div>
<div style="margin-left: 18pt">
<table style="border-collapse: collapse" border="0"><colgroup> <col style="width: 601px" /></colgroup>
<tbody valign="top">
<tr style="height: 56px">
<td style="padding-left: 7px;padding-right: 7px;border: solid 0.5pt">
<p style="margin-left: 18pt"><span style="font-family: Courier New"><span style="font-size: 10pt">navba@CoreLinuxDemo:~/myapp$</span><span style="font-size: 10pt;background-color: lime"><strong><em>dotnet restore</em></strong></span><span style="font-size: 8pt">
</span></span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New"><span style="font-size: 9pt">Restore completed in 39.36 ms for /home/navba/myapp/myapp.csproj.
</span></span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt"> Restore completed in 27.37 ms for /home/navba/myapp/myapp.csproj.
</span></p>
</td>
</tr>
</tbody>
</table>
</div>
<p style="margin-left: 18pt">To run the application, you can run the below command:</p>

<div style="margin-left: 18pt">
<table style="border-collapse: collapse" border="0"><colgroup> <col style="width: 610px" /></colgroup>
<tbody valign="top">
<tr style="height: 95px">
<td style="padding-left: 7px;padding-right: 7px;border: solid 0.5pt">
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 10pt">navba@CoreLinuxDemo:~/myapp$ <span style="background-color: lime"><strong><em>dotnet run</em></strong></span>
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt">warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt"> No XML encryptor configured. Key {79a1ec79-a634-4707-936e-a91a85576f75} may be persisted to storage in unencrypted form.
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt">Hosting environment: Production
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt">Content root path: /home/navba/myapp
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New"><span style="font-size: 10pt">Now listening on</span><span style="font-size: 9pt">: <span style="color: #00b0f0;background-color: yellow;text-decoration: underline"><strong>http://localhost:5000</strong></span>
</span></span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt">Application started. Press Ctrl+C to shut down.
</span></p>
</td>
</tr>
</tbody>
</table>
</div>
<span style="font-size: 10pt"><strong> Note</strong>: dotnet run command will internally run the dotnet restore / dotnet build commands.</span>

4.  To test the application, you can launch another instance of the putty and connect to your LINUX box and try accessing             the  <span style="font-family: Courier New;font-size: 8pt"><a href="http://localhost:5000">http://localhost:5000</a> </span>using curl as shown below:

<span style="font-family: Courier New"><span style="font-size: 10pt">    navba@CoreLinuxDemo:~$ </span><span style="font-size: 10pt;background-color: lime"><strong><em>curl http://localhost:5000</em></strong></span><span style="font-size: 8pt">
</span></span>

You should be getting the html response of the application.

Alternatively, you can also try accessing the app using <span style="font-family: Courier New"><span style="font-size: 12pt"><strong>wget </strong></span></span>as shown below:
<div style="margin-left: 18pt">
<table style="border-collapse: collapse" border="0"><colgroup> <col style="width: 603px" /></colgroup>
<tbody valign="top">
<tr style="height: 162px">
<td style="padding-left: 7px;padding-right: 7px;border: solid 0.5pt">
<p style="margin-left: 18pt"><span style="font-family: Courier New"><span style="font-size: 10pt">navba@CoreLinuxDemo:~$ </span><span style="font-size: 10pt;background-color: lime"><strong><em>wget <a href="http://localhost:5000"></a></em></strong></span></span><span style="background-color: lime"><strong>http://localhost:5000
</strong></span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt">--2017-12-21 12:11:50-- http://localhost:5000/
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt">Resolving localhost (localhost)... 127.0.0.1
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt">Connecting to localhost (localhost)|127.0.0.1|:5000... connected.
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt">HTTP request sent, awaiting response... <span style="background-color: yellow">200 OK</span>
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt">Length: unspecified [text/html]
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt">Saving to: 'index.html'
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt">index.html [ &lt;=&gt; ] 8.62K --.-KB/s in 0s
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt">2017-12-21 12:11:50 (162 MB/s) - 'index.html' saved [8827]
</span></p>
</td>
</tr>
</tbody>
</table>
</div>
<p style="margin-left: 18pt">Once we confirm that we get the expected response from the application we can confirm that the .NET Core SDK is installed fine, and our application is functioning right.</p>
&nbsp;

<span style="text-decoration: underline"><strong>Step 2</strong></span><span style="font-family: Courier New;font-size: 8pt">: </span><strong>Install Nginx server</strong>

1. We install the nginx server using the below command:

<span style="font-family: Courier New"><span style="font-size: 10pt">      navba@CoreLinuxDemo:~/myapp$</span><strong><em><span style="font-size: 10pt;background-color: lime"> sudo apt-get install nginx</span></em></strong></span>

2. Once it is installed, try to access your nginx server using your external IP address of the LINUX box. If you see the nginx HOME page then your nginx server installation did succeed and its functioning fine.
<div style="margin-left: 50pt">
<table style="border-collapse: collapse" border="0"><colgroup> <col style="width: 488px" /></colgroup>
<tbody valign="top">
<tr style="height: 40px">
<td style="padding-left: 7px;padding-right: 7px;border: solid 0.5pt">
<h1><span style="font-family: Tahoma;font-size: 18pt">Welcome to nginx!
</span></h1>
<span style="font-family: Tahoma;font-size: 9pt">If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
</span>

<span style="font-family: Tahoma;font-size: 9pt">For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.
Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.
</span>

<span style="font-family: Tahoma;font-size: 9pt"><em>Thank you for using nginx.</em>
</span>

<span style="font-family: Courier New;font-size: 8pt">
</span></td>
</tr>
</tbody>
</table>
</div>
<span style="font-size: 10pt">
<span style="text-decoration: underline"><strong>Note</strong></span>: Remember to open PORT 80 in the external firewall (if any). See my configurations below:
</span>

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/122817_1354_DeploytheAS1.png" alt="" /><span style="font-family: Courier New;font-size: 8pt">
</span>

&nbsp;

<strong><span style="text-decoration: underline">Step 3:</span> Configuring Nginx as reverse proxy to dotnet core application:</strong>

1. We will clear the default configuration using the below command:

<span style="font-family: Courier New"><span style="font-size: 10pt">    navba@CoreLinuxDemo:~/myapp$ </span><span style="font-size: 10pt;background-color: lime"><strong><em>sudo truncate -s 0 /etc/nginx/sites-available/default</em></strong></span></span>

2. Modify the nginx config using the below command:

<span style="font-family: Courier New"><span style="font-size: 10pt">    navba@CoreLinuxDemo:~/myapp$ </span><span style="font-size: 10pt;background-color: lime"><strong><em>sudo nano /etc/nginx/sites-available/default</em></strong></span><span style="font-size: 8pt">
</span></span>

The editor opens, and you need to <span style="text-decoration: underline"><strong><em>manually</em></strong></span> enter the below to avoid any syntactical errors:
<div style="margin-left: 26pt">
<table style="border-collapse: collapse" border="0"><colgroup> <col style="width: 405px" /></colgroup>
<tbody valign="top">
<tr style="height: 154px">
<td style="padding-left: 7px;padding-right: 7px;border: solid 0.5pt"><span style="font-family: Courier New;font-size: 10pt">server {
</span><span style="font-family: Courier New;font-size: 10pt">    listen 80;
</span><span style="font-family: Courier New;font-size: 10pt">    location / {
</span><span style="font-family: Courier New;font-size: 10pt">        proxy_pass http://localhost:<span style="background-color: yellow">5000</span>;
</span><span style="font-family: Courier New;font-size: 10pt">        proxy_http_version 1.1;
</span><span style="font-family: Courier New;font-size: 10pt">        proxy_set_header Upgrade $http_upgrade;
</span><span style="font-family: Courier New;font-size: 10pt">        proxy_set_header Connection keep-alive;
</span><span style="font-family: Courier New;font-size: 10pt">        proxy_set_header Host $host;
</span><span style="font-family: Courier New;font-size: 10pt">        proxy_cache_bypass $http_upgrade;
</span><span style="font-family: Courier New;font-size: 10pt">    }
</span><span style="font-family: Courier New;font-size: 10pt">}</span></td>
</tr>
</tbody>
</table>
</div>
<span style="font-size: 10pt"><span style="text-decoration: underline"><strong>Note</strong></span>: The port which dotnet.exe process will be listening to can be different, ensure that you place a correct one in the nginx config file.</span>

3. To ensure that you have the syntax placed right in the configuration file you can run the below command:
<div style="margin-left: 18pt">
<table style="border-collapse: collapse" border="0"><colgroup> <col style="width: 586px" /></colgroup>
<tbody valign="top">
<tr style="height: 89px">
<td style="padding-left: 7px;padding-right: 7px;border: solid 0.5pt">
<p style="margin-left: 18pt"><span style="font-family: Courier New"><span style="font-size: 10pt">navba@CoreLinuxDemo:~/myapp$ </span><span style="font-size: 10pt;background-color: lime"><strong><em>sudo nginx -t</em></strong></span><span style="font-size: 8pt">
</span></span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt">nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
</span></p>
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt">nginx: configuration file /etc/nginx/nginx.conf test is successful</span></p>
</td>
</tr>
</tbody>
</table>
</div>
&nbsp;

4. If the above command throws any syntactical errors, you need to verify the nginx configuration and <span>manually</span> type the above entry again.

5. The below command should reload the new configuration settings.

<span style="font-family: Courier New"><span style="font-size: 10pt">   navba@CoreLinuxDemo:~/myapp$ </span><span style="font-size: 10pt;background-color: lime"><strong><em>sudo nginx -s reload</em></strong></span></span>

6. Then you run the <strong>dotnet run</strong> command again to spawn up the dotnet.exe process.

<span style="font-family: Courier New"><span style="font-size: 10pt">   navba@CoreLinuxDemo:~/myapp$ </span><strong><em><span style="font-size: 10pt;background-color: lime">dotnet run</span></em></strong></span>

7. Now try to access the application externally. You should see that the Home/Index page of your MVC application. Our nginx server successfully proxied the request to dotnet application.

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/122817_1354_DeploytheAS2.png" alt="" /><span style="font-family: Courier New;font-size: 8pt">
</span>

<span style="font-size: 10pt"><span style="text-decoration: underline"><strong>Note</strong></span>: If you are having trouble in getting this page, please follow the above steps again.
</span>

Now that the application is up and running on Linux via nginx you can try capturing perfview traces.

Note that you can do custom logging so that it gets logged within the perfview using <a href="https://blogs.msdn.microsoft.com/webtopics/2017/12/27/capturing-perfview-traces-for-aspnet-core-application/"><span style="font-size: 14pt"><strong>this</strong></span></a> article.

&nbsp;

<strong><span style="text-decoration: underline">Step 4:</span> Deploying your concerned Core application to Linux:
</strong>

If you need help in moving your own application from windows environment to Linux before capturing the Perfview traces, you can use <strong>pscp.exe<span style="text-decoration: underline">
</span></strong>1. On your Dev box, Open the <strong>CMD</strong> prompt in admin mode.

2. Navigate to the location where you placed your application.

3. From this folder place the path to your pscp.exe and run the below command to place your application contents within the <strong>myapp</strong> folder within your profile.

<span style="background-color: lime">  E:\dotnet\CoreDemo&gt; C:\temp\pscp.exe -r * navba@52.170.94.20:/home/navba/myapp</span>

4. Post this go back to you linux files and you can run the <span style="font-size: 14pt"><span style="background-color: lime">ls  </span></span>command to ensure that your files have been placed right.

5. Run the <strong>dotnet run </strong>command to launch the dotnet.exe and note the port number it is listening on. Then you modify the nginx configuration file by following the steps from <strong>Step 3</strong> section mentioned above.

&nbsp;

<strong><span style="text-decoration: underline">Step 5: </span>Capturing Perfview traces for your application</strong>

1. Launch a different instance of PUTTY and connect to your LINUX box.

2. The below command will download the perfview tool:

<span style="font-family: 'Courier New';font-size: 10pt">   navba@CoreLinuxDemo:~$</span><strong><span style="font-family: Courier New;font-size: 10pt;background-color: lime"><em>curl -OL http://aka.ms/perfcollect</em></span></strong>

3.  You can confirm it again by using ls command.
<div style="margin-left: 18pt">
<table style="border-collapse: collapse" border="0"><colgroup> <col style="width: 572px" /></colgroup>
<tbody valign="top">
<tr style="height: 59px">
<td style="padding-left: 7px;padding-right: 7px;border: solid 0.5pt">
<p style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 10pt">navba@CoreLinuxDemo:~$<span style="background-color: lime"><strong><em> ls</em></strong></span></span></p>

<h6 style="margin-left: 18pt"><span style="font-family: Courier New;font-size: 9pt">index.html myapp <strong>perfcollect</strong>
</span></h6>
</td>
</tr>
</tbody>
</table>
</div>
4. You can try giving it JUST executable permissions. I simply gave it FULL Control for all groups to avoid any issues.

<span style="font-family: Courier New;font-size: 10pt">  navba@CoreLinuxDemo:~$</span><span style="font-family: Courier New;font-size: 10pt;background-color: lime"><strong><em>chmod 777 perfcollect</em></strong></span>

5. Install the perfview using the below command:

<span style="font-family: Courier New;font-size: 10pt">  navba@CoreLinuxDemo:~$ </span><span style="font-family: Courier New;font-size: 10pt;background-color: lime"><strong><em>sudo ./perfcollect install</em></strong></span>

6. Add the below environment variable before you start collecting the trace:

<span style="font-family: Courier New;font-size: 10pt">  navba@CoreLinuxDemo:~$ </span><span style="font-family: Courier New;font-size: 10pt;background-color: lime"><strong><em>export COMPlus_PerfMapEnabled=1</em></strong></span>

7. Then you run the below command to start collecting it. Ensure that your <strong>dotnet.exe</strong> process is running and try accessing your application.

8. Once you are sure that you have captured the issue, you can stop the perfview by clicking Ctrl + C as shown below:

<span>navba@CoreLinuxDemo:~$ </span><strong><span><em>sudo ./perfcollect collect MyPerfviewFile</em></span></strong>

<span style="background-color: aqua">Collection started. Press CTRL+C to stop.</span>

<span style="font-family: Courier New;font-size: 9pt">^C
</span>

<span style="font-family: Courier New;font-size: 9pt">...STOPPED.
</span>

<span style="font-family: Courier New;font-size: 9pt">Starting post-processing. This may take some time.
</span>

<span style="font-family: Courier New;font-size: 9pt">Generating native image symbol files
</span>

<span style="font-family: Courier New;font-size: 9pt">...SKIPPED
</span>

<span style="font-family: Courier New;font-size: 9pt">Crossgen not found. Framework symbols will be unavailable.
</span>

<span style="font-family: Courier New;font-size: 9pt">See https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/lin ux-performance-tracing.md#resolving-framework-symbols for details.
</span>

<span style="font-family: Courier New;font-size: 9pt">Saving native symbols
</span>

<span style="font-family: Courier New;font-size: 9pt">...FINISHED
</span>

<span style="font-family: Courier New;font-size: 9pt">Exporting perf.data file
</span>

<span style="font-family: Courier New;font-size: 9pt">...FINISHED
</span>

<span style="font-family: Courier New;font-size: 9pt">Compressing trace files
</span>

<span style="font-family: Courier New;font-size: 9pt">...FINISHED
</span>

<span style="font-family: Courier New;font-size: 9pt">Cleaning up artifacts
</span>

<span style="font-family: Courier New;font-size: 9pt">...FINISHED
</span>

<span style="font-family: Courier New;font-size: 10pt;background-color: yellow">Trace saved to MyPerfviewFile.trace.zip</span>

8. You can run the ls command to see the collected trace:
<div style="margin-left: 18pt">
<table style="border-collapse: collapse" border="0"><colgroup> <col style="width: 599px" /></colgroup>
<tbody valign="top">
<tr>
<td style="padding-left: 7px;padding-right: 7px;border: solid 0.5pt"><span style="font-family: Courier New;font-size: 10pt">navba@CoreLinuxDemo:~$<span style="background-color: lime"><strong><em> ls</em></strong></span></span>

<span style="font-family: Courier New;font-size: 9pt">index.html lttng-traces myapp <span style="background-color: yellow">MyPerfviewFile.trace.zip</span> perfcollect
</span></td>
</tr>
</tbody>
</table>
</div>
&nbsp;

More Info about the analysis of perfview trace on Linux you can see this:

<a href="https://blogs.msdn.microsoft.com/vancem/2016/02/20/analyzing-cpu-traces-from-linux-with-perfview/"><strong>https://blogs.msdn.microsoft.com/vancem/2016/02/20/analyzing-cpu-traces-from-linux-with-perfview/</strong></a><strong>
</strong>

&nbsp;

Hope this helps :)]]></content:encoded>
    </item>
    <item>
      <title>Capturing Perfview traces for ASPNET Core application</title>
      <link>https://docs.microsoft.com/archive/blogs/webtopics/capturing-perfview-traces-for-aspnet-core-application</link>
      <pubDate>Wed, 27 Dec 2017 17:43:22 GMT</pubDate>
      <dc:creator><![CDATA[Naveen Baliga]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/webtopics/?p=1507</guid>
      <description><![CDATA[Recently, I worked with one of the customer who wanted assistance in implementing the logging and...]]></description>
      <content:encoded><![CDATA[Recently, I worked with one of the customer who wanted assistance in implementing the logging and capturing the <a href="https://www.microsoft.com/en-us/download/details.aspx?id=28567">perfview</a> traces for aspnet core web application.

So, I decided to blog on this topic and explain how to enable the logging, capture and analyze perfview trace.

I am making use of a simple ASPNET Core MVC application here to explain this.

I have the below lines in my <strong>Program.cs </strong>file:
<div>
<table style="border-collapse: collapse" border="0"><colgroup> <col style="width: 848px" /></colgroup>
<tbody valign="top">
<tr style="height: 188px">
<td style="padding-left: 7px;padding-right: 7px;border: solid 0.5pt"><span style="color: blue;font-family: Courier New;font-size: 9pt">static <span style="color: black"><span style="color: blue">void<span style="color: black"> Main(<span style="color: blue">string<span style="color: black">[] args)</span></span></span></span></span></span>

<span style="color: black;font-family: 'Courier New';font-size: 9pt">{</span>

<span style="color: black;font-family: Courier New;font-size: 9pt">    BuildWebHost(args).Run();
</span>

<span style="color: black;font-family: Courier New;font-size: 9pt">}
</span>

<span style="color: blue;font-family: 'Courier New';font-size: 9pt">public </span><span style="color: black"><span style="color: blue">static<span style="color: black"> IWebHost BuildWebHost(<span style="color: blue">string<span style="color: black">[] args) =&gt;</span></span></span></span></span>

<span style="color: black;font-family: Courier New;font-size: 9pt"> WebHost.CreateDefaultBuilder(args)
</span>

<span style="color: black;font-family: Courier New;font-size: 9pt"> .CaptureStartupErrors(<span style="color: blue">true<span style="color: black">)
</span></span></span>

<span style="color: black;font-family: Courier New;font-size: 9pt"><span style="color: green">// THE ABOVE LINE IS FOR THE STARTUP RELATED ISSUES <span style="color: black">
</span></span></span>

<span style="color: black;font-family: Courier New;font-size: 9pt"> .UseSetting(WebHostDefaults.DetailedErrorsKey,<span style="color: #a31515">"true"<span style="color: black">)
</span></span></span>

<span style="color: green;font-family: Courier New;font-size: 9pt"> //THE ABOVE LINE WILL GIVE A DETAILED ERROR PAGE IN CASE OF ANY FAILURE<span style="color: black">
</span></span>

<span style="color: black;font-family: Courier New;font-size: 9pt"> .UseStartup&lt;Startup&gt;()
</span>

<span style="color: black;font-family: Courier New;font-size: 9pt"> .UseKestrel()
</span>

<span style="color: black;font-family: Courier New;font-size: 9pt"> .ConfigureLogging((hostingContext,logging)=&gt;
</span>

<span style="color: black;font-family: Courier New;font-size: 9pt"> {
</span>

<span style="color: black;font-family: Courier New;font-size: 9pt">   logging.AddConfiguration(hostingContext.Configuration.GetSection(<span style="color: #a31515">"Logging"<span style="color: black">));
</span></span></span>

<span style="color: black;font-family: Courier New;font-size: 9pt">   logging.AddConsole();
</span>

<span style="color: green;font-family: Courier New;font-size: 9pt">   //THE ABOVE LINE WILL DISPLAY THE LOGS IN CONSOLE WHILE RUNNING THE APP FROM THE CMD LINE<span style="color: black">
</span></span>

<span style="color: black;font-family: Courier New;font-size: 9pt">   logging.AddDebug();
</span>

<span style="color: green;font-family: Courier New;font-size: 9pt">   //THE ABOVE LINE WILL DISPLAY THE LOGS IN DEBUG OUTPUT WINDOW<span style="color: black">
</span></span>

<span style="color: black;font-family: Courier New;font-size: 9pt">   logging.AddEventSourceLogger();
</span>

<span style="color: green;font-family: Courier New;font-size: 9pt">   //<strong>THE ABOVE LINE IS FOR THE PERFVIEW</strong></span>

<span style="color: green;font-family: Courier New;font-size: 9pt"><span style="color: black;font-size: 9pt">}</span></span><span style="color: green;font-family: Courier New;font-size: 9pt"><span style="color: black;font-size: 9pt">)</span>
</span>

<span style="color: black;font-family: Courier New;font-size: 9pt"> .Build();
</span></td>
</tr>
</tbody>
</table>
</div>
&nbsp;

Ensure that you have placed the below namespaces within your Program.cs

<span style="color: blue;font-family: Courier New;font-size: 10pt">   using<span style="color: black"> Microsoft.AspNetCore.Hosting;
</span></span>

<span style="color: blue;font-family: Courier New;font-size: 10pt">   using<span style="color: black"> Microsoft.Extensions.Logging;
</span></span>

<span style="color: blue;font-family: Courier New;font-size: 10pt">   using<span style="color: black"> Microsoft.AspNetCore;</span>
</span>

You can make use of the <a href="https://www.nuget.org/packages/Microsoft.Extensions.Logging/"><strong>Nuget</strong></a> PM to install the <span style="color: black;font-family: Consolas;font-size: 9pt"><strong>Microsoft.Extensions.Logging </strong></span>component.

Go to your <strong>concerned</strong> Controller and ensure that you have referenced the logging component
<div>
<table style="border-collapse: collapse" border="0"><colgroup> <col style="width: 833px" /></colgroup>
<tbody valign="top">
<tr style="height: 167px">
<td style="padding-left: 7px;padding-right: 7px;border: solid 0.5pt"><span style="color: blue;font-family: Courier New;font-size: 9pt">public <span style="color: black"><span style="color: blue">class <span style="color: black"><span style="color: #2b91af">HomeController<span style="color: black"> : Controller
</span></span></span></span></span></span><span style="color: black;font-family: Courier New;font-size: 9pt">{
</span><span style="color: black;font-family: Courier New;font-size: 9pt"><span style="color: green">    // GET: /&lt;controller&gt;/<span style="color: black">
</span></span></span>

<span style="color: black;font-family: Courier New;font-size: 9pt"><span style="color: blue">    private <span style="color: black"><span style="color: blue">readonly<span style="color: black"> ILogger _logger;
</span></span></span></span></span>

<span style="color: black;font-family: Courier New;font-size: 9pt"><span style="color: blue">    public<span style="color: black"> HomeController(ILogger&lt;HomeController&gt; logger)
</span></span></span>

<span style="color: black;font-family: Courier New;font-size: 9pt">    {
</span>

<span style="color: black;font-family: Courier New;font-size: 9pt">       _logger = logger;
</span>

<span style="color: black;font-family: Courier New;font-size: 9pt">    }
</span>

<span style="color: black;font-family: Courier New;font-size: 9pt"><span style="color: blue">    public<span style="color: black"> IActionResult Index()
</span></span></span>

<span style="color: black;font-family: Courier New;font-size: 9pt">    {
</span>

<span style="color: black;font-family: Courier New;font-size: 9pt"><span style="color: green">       // This code specifies the loglevel.
</span></span>

<span style="color: green;font-family: Courier New;font-size: 9pt">       // Ex: LogInformation, LogWarning, LogCritical, LogDebug etc<span style="color: black">
</span></span>

<span style="color: black;font-family: Courier New;font-size: 9pt">       _logger.LogInformation(1000, <span style="color: #a31515">"In Index method.............."<span style="color: black">);
</span></span></span>

<span style="color: black;font-family: Courier New;font-size: 9pt"><span style="color: blue">       return<span style="color: black"> View();
</span></span></span>

<span style="color: black;font-family: Courier New;font-size: 9pt">    }
</span>

<span style="color: black;font-family: Courier New;font-size: 9pt">}
</span></td>
</tr>
</tbody>
</table>
</div>
&nbsp;

Ensure that you have placed the below namespaces within your Controller:

<span style="color: blue;font-family: Courier New;font-size: 10pt">   using<span style="color: black"> Microsoft.AspNetCore.Mvc;
</span></span>

<span style="color: blue"><span style="font-family: Courier New;font-size: 10pt">   using<span style="color: black"> Microsoft.Extensions.Logging;</span></span><span style="font-family: Consolas;font-size: 9pt">
</span></span>

After doing the above changes, you will see the Logging information within your <strong>Debug Output</strong> window and the <strong>CMD </strong>console.

&nbsp;

<span style="text-decoration: underline"><strong>In the Debug window:
</strong></span>
<div>
<table style="border-collapse: collapse" border="0"><colgroup> <col style="width: 828px" /></colgroup>
<tbody valign="top">
<tr style="height: 87px">
<td style="padding-left: 7px;padding-right: 7px;border: solid 0.5pt"><span style="font-family: Courier New;font-size: 8pt">Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://localhost:5761/home/index
</span><span style="font-family: Courier New;font-size: 8pt">Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://localhost:5761/home/index
</span><span style="font-family: Courier New;font-size: 8pt">------------------------------------
</span>

<span style="font-family: Courier New;font-size: 8pt">Demo.Controllers.HomeController:Information: <span style="background-color: yellow">In Index method..............</span>
</span>

<span style="font-family: Courier New;font-size: 8pt">Demo.Controllers.HomeController:Information: <span style="background-color: yellow">In Index method..............</span>
</span></td>
</tr>
</tbody>
</table>
</div>
&nbsp;

<span style="text-decoration: underline"><strong>In the CMD console:
</strong></span>
<div>
<table style="border-collapse: collapse" border="0"><colgroup> <col style="width: 822px" /></colgroup>
<tbody valign="top">
<tr style="height: 97px">
<td style="padding-left: 7px;padding-right: 7px;border: solid 0.5pt"><span style="font-family: Courier New;font-size: 8pt">info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
</span><span style="font-family: Courier New;font-size: 8pt"> Request starting HTTP/1.1 GET http://localhost:5762/home/index
</span><span style="font-family: Courier New;font-size: 8pt">info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
</span>

<span style="font-family: Courier New;font-size: 8pt"> Request starting HTTP/1.1 GET http://localhost:5762/home/index
</span>

<span style="font-family: Courier New;font-size: 8pt">info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
</span>

<span style="font-family: Courier New;font-size: 8pt"> Executing action method Demo.Controllers.HomeController.Index (Demo) with arguments ((null)) - ModelState is Valid
</span>

<span style="font-family: Courier New;font-size: 8pt">info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
</span>

<span style="font-family: Courier New;font-size: 8pt"> Executing action method Demo.Controllers.HomeController.Index (Demo) with arguments ((null)) - ModelState is Valid
</span>

<span style="font-family: Courier New;font-size: 8pt">infoinfo: Demo.Controllers.HomeController[1000] </span><span style="background-color: yellow;font-family: 'Courier New';font-size: 8pt">In Index method..............</span>

<span style="font-family: Courier New;font-size: 8pt">: Demo.Controllers.HomeController[1000] </span><span style="background-color: yellow;font-family: 'Courier New';font-size: 8pt">In Index method..............</span>

<span style="font-family: Courier New;font-size: 8pt">info: Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor[1]
</span>

<span style="font-family: Courier New;font-size: 8pt"> Executing ViewResult, running view at path /Views/Home/Index.cshtml.
</span>

<span style="font-family: Courier New;font-size: 8pt">info: Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor[1]
</span>

<span style="font-family: Courier New;font-size: 8pt"> Executing ViewResult, running view at path /Views/Home/Index.cshtml.
</span>

<span style="font-family: Courier New;font-size: 8pt">info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
</span>

<span style="font-family: Courier New;font-size: 8pt"> Executed action Demo.Controllers.HomeController.Index (Demo) in 4628.1449ms
</span>

<span style="font-family: Courier New;font-size: 8pt">info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
</span>

<span style="font-family: Courier New;font-size: 8pt"> Executed action Demo.Controllers.HomeController.Index (Demo) in 4628.1449ms
</span>

<span style="font-family: Courier New;font-size: 8pt">info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
</span>

<span style="font-family: Courier New;font-size: 8pt"> Request finished in 4686.3757ms 200 text/html; charset=utf-8
</span>

<span style="font-family: Courier New;font-size: 8pt">info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
</span>

<span style="font-family: Courier New;font-size: 8pt"> Request finished in 4686.3757ms 200 text/html; charset=utf-8
</span></td>
</tr>
</tbody>
</table>
</div>
&nbsp;

<span style="text-decoration: underline"><strong>Perfview Data Collection:
</strong></span>

Download the Perfview from the below location and place it on the machine where you have the ASPNET Core app running:

<a href="https://www.microsoft.com/en-us/download/details.aspx?id=28567">https://www.microsoft.com/en-us/download/details.aspx?id=28567</a>

<span style="text-decoration: underline"><strong><em>Data Capture:
</em></strong></span>
<ul>
 	<li>Open <strong>Perfview</strong>.</li>
 	<li>Go to <strong>Collect</strong> and select <strong>Collect</strong> option as shown below:</li>
</ul>
<img src="https://msdnshared.blob.core.windows.net/media/2017/12/122717_1733_CapturingPe1.png" alt="" class="aligncenter" />
<ul>
 	<li>Expand the <strong>Advanced Options</strong>.</li>
 	<li>Enable the <strong>Thread Time</strong> and <strong>IIS </strong>providers. (This will help us give some additional Information while troubleshooting) <span style="font-size: 9pt"><strong>Note</strong>: IIS provider is needed if the app is hosted on IIS. Else you can skip it. This provider can be used only if the IIS <strong>Tracing</strong> feature is installed.
</span></li>
 	<li>Place the <strong>*Microsoft-Extensions-Logging </strong>section within <strong>Additional Providers</strong> section as shown below:</li>
</ul>
<img src="https://msdnshared.blob.core.windows.net/media/2017/12/122717_1733_CapturingPe2.png" alt="" class="aligncenter" />

&nbsp;

<span style="text-decoration: underline"><strong>Perfview Analysis:
</strong></span>

After we open the perfview ETL trace we see our logging information being logged:
<div>
<table style="border-collapse: collapse" border="0"><colgroup> <col style="width: 205px" /> <col style="width: 86px" /> <col style="width: 78px" /> <col style="width: 458px" /></colgroup>
<tbody valign="top">
<tr>
<td style="padding-left: 7px;padding-right: 7px;border-top: solid #999999 0.5pt;border-left: solid #999999 0.5pt;border-bottom: solid #666666 1.5pt;border-right: solid #999999 0.5pt"><span style="font-family: Times New Roman;font-size: 12pt"><strong>Event Name                                   </strong></span></td>
<td style="padding-left: 7px;padding-right: 7px;border-top: solid #999999 0.5pt;border-left: none;border-bottom: solid #666666 1.5pt;border-right: solid #999999 0.5pt"><span style="font-family: Times New Roman;font-size: 12pt"><strong>Time MSec</strong></span></td>
<td style="padding-left: 7px;padding-right: 7px;border-top: solid #999999 0.5pt;border-left: none;border-bottom: solid #666666 1.5pt;border-right: solid #999999 0.5pt"><span style="font-family: Times New Roman;font-size: 12pt"><strong>Process Name  </strong></span></td>
<td style="padding-left: 7px;padding-right: 7px;border-top: solid #999999 0.5pt;border-left: none;border-bottom: solid #666666 1.5pt;border-right: solid #999999 0.5pt"><span style="font-family: Times New Roman;font-size: 12pt"><strong>Rest  </strong></span></td>
</tr>
<tr>
<td style="padding-left: 7px;padding-right: 7px;border-top: none;border-left: solid #999999 0.5pt;border-bottom: solid #999999 0.5pt;border-right: solid #999999 0.5pt"><span style="font-family: Courier New;font-size: 9pt"><strong>Microsoft-Extensions-Logging/FormattedMessage</strong></span></td>
<td style="padding-left: 7px;padding-right: 7px;border-top: none;border-left: none;border-bottom: solid #999999 0.5pt;border-right: solid #999999 0.5pt"><span style="font-family: Courier New;font-size: 9pt">39,706.201</span></td>
<td style="padding-left: 7px;padding-right: 7px;border-top: none;border-left: none;border-bottom: solid #999999 0.5pt;border-right: solid #999999 0.5pt"><span style="font-family: Courier New;font-size: 9pt">dotnet (25292)</span></td>
<td style="padding-left: 7px;padding-right: 7px;border-top: none;border-left: none;border-bottom: solid #999999 0.5pt;border-right: solid #999999 0.5pt"><span style="font-family: Courier New;font-size: 9pt">ThreadID="285,016" Level="2" FactoryID="1" LoggerName="Demo.Controllers.HomeController" EventId="1000" FormattedMessage="<span style="background-color: yellow">In Index method..............</span>" ActivityID="//1/3/1/" </span></td>
</tr>
<tr>
<td style="padding-left: 7px;padding-right: 7px;border-top: none;border-left: solid #999999 0.5pt;border-bottom: solid #999999 0.5pt;border-right: solid #999999 0.5pt"><span style="font-family: Courier New;font-size: 9pt"><strong>Microsoft-Extensions-Logging/Message         </strong></span></td>
<td style="padding-left: 7px;padding-right: 7px;border-top: none;border-left: none;border-bottom: solid #999999 0.5pt;border-right: solid #999999 0.5pt"><span style="font-family: Courier New;font-size: 9pt">39,708.668</span></td>
<td style="padding-left: 7px;padding-right: 7px;border-top: none;border-left: none;border-bottom: solid #999999 0.5pt;border-right: solid #999999 0.5pt"><span style="font-family: Courier New;font-size: 9pt">dotnet (25292)</span></td>
<td style="padding-left: 7px;padding-right: 7px;border-top: none;border-left: none;border-bottom: solid #999999 0.5pt;border-right: solid #999999 0.5pt"><span style="font-family: Courier New;font-size: 9pt">ThreadID="285,016" Level="2" FactoryID="1" LoggerName="Demo.Controllers.HomeController" EventId="1000" Exception="{ TypeName="", Message="", HResult=0, VerboseMessage="" }" Arguments="[{ Key="{OriginalFormat}", Value="<span style="background-color: yellow">In Index method..............</span>" }]" ActivityID="//1/3/1/" </span></td>
</tr>
<tr>
<td style="padding-left: 7px;padding-right: 7px;border-top: none;border-left: solid #999999 0.5pt;border-bottom: solid #999999 0.5pt;border-right: solid #999999 0.5pt"><span style="font-family: Courier New;font-size: 9pt"><strong>Microsoft-Extensions-Logging/MessageJson     </strong></span></td>
<td style="padding-left: 7px;padding-right: 7px;border-top: none;border-left: none;border-bottom: solid #999999 0.5pt;border-right: solid #999999 0.5pt"><span style="font-family: Courier New;font-size: 9pt">39,708.700</span></td>
<td style="padding-left: 7px;padding-right: 7px;border-top: none;border-left: none;border-bottom: solid #999999 0.5pt;border-right: solid #999999 0.5pt"><span style="font-family: Courier New;font-size: 9pt">dotnet (25292)</span></td>
<td style="padding-left: 7px;padding-right: 7px;border-top: none;border-left: none;border-bottom: solid #999999 0.5pt;border-right: solid #999999 0.5pt"><span style="font-family: Courier New;font-size: 9pt">ThreadID="285,016" Level="2" FactoryID="1" LoggerName="Demo.Controllers.HomeController" EventId="1000" ExceptionJson="{}" ArgumentsJson="{"{OriginalFormat}":</span>

<span style="font-family: Courier New;font-size: 9pt">"<span style="background-color: yellow">In Index method..............</span>"}" ActivityID="//1/3/1/" </span></td>
</tr>
</tbody>
</table>
</div>
&nbsp;

Hope this helps :)]]></content:encoded>
    </item>
    <item>
      <title>IIS FTP with ASP.NET membership authentication</title>
      <link>https://docs.microsoft.com/archive/blogs/webtopics/iis-ftp-with-asp-net-membership-authentication</link>
      <pubDate>Wed, 27 Dec 2017 17:21:14 GMT</pubDate>
      <dc:creator><![CDATA[Naveen Baliga]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/webtopics/?p=1496</guid>
      <description><![CDATA[This is my second blog on FTP. The first one being this.

This blog specifically explains how to...]]></description>
      <content:encoded><![CDATA[This is my second blog on FTP. The first one being <a href="https://blogs.msdn.microsoft.com/webtopics/2014/09/05/revisiting-ftp-basics/"><span style="font-size: 12pt"><strong>this</strong></span></a>.

This blog specifically explains how to address the below error which most of them have encountered while setting up the ASP.NET SQL membership authentication with FTP site:
<p style="margin-left: 54pt"><span style="color: green;font-family: Courier New;font-size: 10pt">Response:       220 Microsoft FTP Service<span style="color: navy">
</span></span></p>
<p style="margin-left: 54pt"><span style="color: navy;font-family: Courier New;font-size: 10pt">Command:        USER test<span style="color: green">
</span></span></p>
<p style="margin-left: 54pt"><span style="color: green;font-family: Courier New;font-size: 10pt">Response:       331 Password required<span style="color: navy">
</span></span></p>
<p style="margin-left: 54pt"><span style="color: navy;font-family: Courier New;font-size: 10pt">Command:        PASS *********<span style="color: green">
</span></span></p>
<p style="margin-left: 54pt"><span style="color: green;font-family: Courier New;font-size: 10pt">Response:       530-User cannot log in.
</span></p>
<p style="margin-left: 54pt"><span style="color: green;font-family: Courier New;font-size: 10pt">Response:       Win32 error:
</span></p>
<p style="margin-left: 54pt"><span style="color: green;font-family: Courier New;font-size: 10pt">Response:       Error details: <strong>System.Web: Default Membership Provider could not be found.
</strong></span></p>
<p style="margin-left: 54pt"><span style="color: green;font-family: Courier New;font-size: 10pt">Response:       530 End<span style="color: red">
</span></span></p>
<p style="margin-left: 54pt"><span style="font-family: Courier New;font-size: 10pt"><span style="color: red">Error:          Critical error: Could not connect to server</span>
</span></p>
You can follow <a href="https://docs.microsoft.com/en-us/iis/publish/using-the-ftp-service/configuring-ftp-with-net-membership-authentication-in-iis-7"><span style="font-size: 14pt"><strong>this</strong></span></a> blog to configure the authentication with SQL membership for the FTP site on IIS.

Post this if you still run into the above issue then you need to ensure that the following steps are followed:

<span style="background-color: yellow;text-decoration: underline"><strong>Steps 1:
</strong></span>

Have the below setting within the <strong>web.config </strong>within the<strong> &lt;configuration&gt; </strong>tag<strong>.</strong> (depending on the framework and the bitness your application pool is using)

<span style="text-decoration: underline"><strong>Example</strong></span>: If your AppPool is 64 bit running under .NET 4.0. You should be using the location <span style="font-family: Wingdings"></span> C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
<div>
<table style="border-collapse: collapse" border="0"><colgroup> <col style="width: 986px" /></colgroup>
<tbody valign="top">
<tr style="height: 89px">
<td style="padding-left: 7px;padding-right: 7px;border: solid 0.5pt"><span style="font-family: Courier New;font-size: 8pt">&lt;location path="GlobalFtpSite/ftpsvc"&gt;
</span><span style="font-family: Courier New;font-size: 8pt">  &lt;connectionStrings&gt;
</span>

<span style="font-family: Courier New;font-size: 8pt">    &lt;add connectionString="server=localhost;database=aspnetdb;Integrated Security=SSPI" name="FtpLocalSQLServer" /&gt;
</span>

<span style="font-family: Courier New;font-size: 8pt">   &lt;/connectionStrings&gt;
</span>

<span style="font-family: Courier New;font-size: 8pt"> &lt;system.web&gt;
</span>

<span style="font-family: Courier New;font-size: 8pt">   &lt;membership defaultProvider="FtpSqlMembershipProvider"&gt;
</span>

<span style="font-family: Courier New;font-size: 8pt">     &lt;providers&gt;
</span>

<span style="font-family: Courier New;font-size: 8pt">        &lt;add name="FtpSqlMembershipProvider"
</span>

<span style="font-family: Courier New;font-size: 8pt">           type="System.Web.Security.SqlMembershipProvider,System.Web,Version=<span style="background-color: yellow">4.0.0.0</span>,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"
</span>

<span style="font-family: Courier New;font-size: 8pt">           connectionStringName="FtpLocalSQLServer"
</span>

<span style="font-family: Courier New;font-size: 8pt">           enablePasswordRetrieval="false"
</span>

<span style="font-family: Courier New;font-size: 8pt">           enablePasswordReset="false"
</span>

<span style="font-family: Courier New;font-size: 8pt">           requiresQuestionAndAnswer="false"
</span>

<span style="font-family: Courier New;font-size: 8pt">           applicationName="/"
</span>

<span style="font-family: Courier New;font-size: 8pt">           requiresUniqueEmail="false"
</span>

<span style="font-family: Courier New;font-size: 8pt">           passwordFormat="Clear" /&gt;
</span>

<span style="font-family: Courier New;font-size: 8pt">      &lt;/providers&gt;
</span>

<span style="font-family: Courier New;font-size: 8pt">   &lt;/membership&gt;
</span>

<span style="font-family: Courier New;font-size: 8pt">   &lt;roleManager defaultProvider="FtpSqlRoleProvider" enabled="true"&gt;
</span>

<span style="font-family: Courier New;font-size: 8pt">      &lt;providers&gt;
</span>

<span style="font-family: Courier New;font-size: 8pt">        &lt;add name="FtpSqlRoleProvider"
</span>

<span style="font-family: Courier New;font-size: 8pt">           type="System.Web.Security.SqlRoleProvider,System.Web,Version=<span style="background-color: yellow">4.0.0.0</span>,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"
</span>

<span style="font-family: Courier New;font-size: 8pt">           connectionStringName="FtpLocalSQLServer"
</span>

<span style="font-family: Courier New;font-size: 8pt">           applicationName="/" /&gt;
</span>

<span style="font-family: Courier New;font-size: 8pt">         &lt;/providers&gt;
</span>

<span style="font-family: Courier New;font-size: 8pt">      &lt;/roleManager&gt;
</span>

<span style="font-family: Courier New;font-size: 8pt">   &lt;/system.web&gt;
</span>

<span style="font-family: Courier New;font-size: 8pt"> &lt;/location&gt;
</span>

<span style="font-family: Courier New;font-size: 8pt">&lt;/configuration&gt;
</span></td>
</tr>
</tbody>
</table>
</div>
<span style="font-size: 10pt;text-decoration: underline"><strong><em>Note:
</em></strong></span>

If you are making use AppPool which is on .NET version 2.0 with 64 bit, then you need to modify the web.config in the location C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG. Also ensure that you have modified the above highlighted section to 2.0.0.0.

<span style="background-color: yellow;text-decoration: underline"><strong>Steps 2:
</strong></span>

Grant the permissions to the <strong><em>Network Service</em></strong> Account <strong>Write / Modify</strong> permissions to the <span style="text-decoration: underline">C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files</span>\ folder. <strong><em>Note</em></strong>: depending on your AppPool framework and bitness the above path can differ.

<span style="background-color: yellow;text-decoration: underline"><strong>Steps 3:
</strong></span>

Remember You don't need to have any settings at the FTP website level for the .NET Roles, .NET Users etc, Because <span style="color: black;font-family: Segoe UI;font-size: 10pt">the root web.config setting should apply to all the applications which run on that version of framework and bitness.
</span>

Hope this helps :)]]></content:encoded>
    </item>
    <item>
      <title>Session State Is Lost in Web Farm If You Use SqlServer or StateServer Session Mode</title>
      <link>https://docs.microsoft.com/archive/blogs/webtopics/session-state-is-lost-in-web-farm-if-you-use-sqlserver-or-stateserver-session-mode</link>
      <pubDate>Wed, 21 Jun 2017 21:02:48 GMT</pubDate>
      <dc:creator><![CDATA[Nikita Habib]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/webtopics/?p=1455</guid>
      <description><![CDATA[One of the most common issues that users face when hosting their application in a webfarm is...]]></description>
      <content:encoded><![CDATA[One of the most common issues that users face when hosting their application in a webfarm is “<strong>unexpected loss of session state</strong>”. We face these issues when we store the session information <strong>inproc</strong>, especially when we don’t set client affinity in the load balancer level.

This is one of the main reasons why users opt for an <strong>outproc</strong> session storage technique (like a SQL server or State Server). But, when you are configuring a state server across a web farm, maintaining the session state across multiple servers and applications is a matter of challenge for which you must take care of a little configuration piece while setting your sites.

Let me give you a brief idea on what we can do and why we are supposed to concentrate on such configuration settings while setting up our sites in a webfarm environment.
<ul>
 	<li>When we make a request, a worker process will be spawned which is always associated with a site ID.</li>
 	<li>The user is assigned with a unique session ID when the session begins. The user will then send that session ID to the server for every request.</li>
 	<li>When the session information is stored in the SQL Server or state server, to uniquely identify the session information for each user specific to each application, it is associated with a primary key.</li>
 	<li>That primary key is a combination of the session ID assigned to the user (that you might see in the request header) and the application ID.</li>
</ul>
For example, the value looks like: ’<strong>13clw2vlrjio0d45opi0qg4500000002</strong>’ where 2 is site id

<a href="https://msdnshared.blob.core.windows.net/media/2017/06/article.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/06/article.jpg" alt="" width="602" height="138" class="alignnone wp-image-1465 size-full" /></a>

You should ensure that your website is associated with the same site ID in all the web servers which are behind a load balancer to avoid unexpected session state losses.When we are configuring the application in multiple servers and when the site ID’s are different in different servers, this primary key will become different for different servers. That will produce a behavior similar to storing the session inproc.

<strong><u>Conclusion:
</u></strong>Maintaining same site ID for the same application across all the servers in the webfarm is important and will help in maintaining the session state when going with out-of-proc approach in a multi-server environment

Please leave your comments if you have any questions around this or need any clarification.]]></content:encoded>
    </item>
    <item>
      <title>Data Collection for Deadlock Detected issue of a IIS based web application</title>
      <link>https://docs.microsoft.com/archive/blogs/webtopics/data-collection-for-deadlock-detected-issue-of-a-iis-based-web-application</link>
      <pubDate>Tue, 05 Apr 2016 13:25:47 GMT</pubDate>
      <dc:creator><![CDATA[Chiranth Ramaswamy]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/webtopics/?p=1441</guid>
      <description><![CDATA[Defining a w3wp deadlock detected issue: Sometimes we might see that the website hosted on IIS...]]></description>
      <content:encoded><![CDATA[<p><b><span style="text-decoration: underline">Defining a w3wp deadlock detected issue:</span></b></p> <p>Sometimes we might see that the website hosted on IIS became unresponsive for some time and we see any of the below event log entry</p> <p>1) ISAPI 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll' reported itself as unhealthy for the following reason: 'Deadlock detected'.</p> <p>2) ISAPI’C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll’ reported itself as unhealthy for the following reason: ‘Deadlock detected’”</p> <p>3) Description: ISAPI 'C:\Windows\system32\inetsrv\asp.dll' reported itself as unhealthy for the following reason: 'ASP unhealthy because 100% of executing requests are hung and 0% of the request queue is full.'</p> <p>When a Web application is busy, there may be instances when the maximum number of threads has been spawned and some of the threads are unresponsive, resulting in degraded performance. IIS has the ability to solve the problem of unresponsive threads by recycling the worker process that hosts that particular instance of the ISAPI. When threads are unresponsive the appropriate ISAPI i.e ASP.dll or aspnet_isapi.dll calls the ISAPI server support function HSE_REQ_REPORT_UNHEALTHY, and the WAS (in IIS 7) or WWW service(in IIS 6) will recycle the worker process and make an entry in the event log.</p> <p><a href="https://msdn.microsoft.com/en-us/library/ms524715(VS.90).aspx">https://msdn.microsoft.com/en-us/library/ms524715(VS.90).aspx</a></p> <p>So when we see a deadlock there might not be an actual deadlock for any resource and it might just be that all the threads are busy doing some task.</p> <p><b><span style="text-decoration: underline">Steps to Create Debug Diag Rule:</span></b></p> <p>1. We will use Debug Diagnostic 2.0 update 2 version to troubleshoot this issue further. Please install the Debug Diagnostic 2.0 update 2 tool from <a href="https://www.microsoft.com/en-us/download/details.aspx?id=49924&nbsp;">https://www.microsoft.com/en-us/download/details.aspx?id=49924 </a>(Please un-install all other versions of Debug Diagnostic tool before installing the latest version)</p> <p>2. Before proceeding with the rule creation we need to download the symbols needed for the automated rule creation. Take the below steps to download the symbols for your w3wp process.</p> <table cellspacing="0" cellpadding="2" width="605" border="1"> <tbody> <tr> <td valign="top" width="603">a. Download <b>PDBDownloader.exe </b>from <a href="https://github.com/rajkumar-rangaraj/PDB-Downloader/releases">https://github.com/rajkumar-rangaraj/PDB-Downloader/releases</a>b. Run the <b>PDBDownloader.exe</b> and click on open files  <p>c. If it is a IIS 6 machine, Navigate to the path <b>C:\Windows\System32\inetsrv\ </b>and select <b>w3isapi.dll</b>. Click on Start</p> <p>d. If it is a IIS 7 or higher machine, Navigate to the path <b>C:\Windows\System32\inetsrv\ </b>and select <b>isapi.dll</b>. Click on Start</p> <p>e. If it is a 32 bit application on a 64 bit IIS 6 machine, Navigate to the path <b>C:\Windows\SysWow64\inetsrv\ </b>and select <b>w3isapi.dll</b>. Click on Start</p> <p>f. If it is a 32 bit application on a 64 bit IIS 7 or higher machine, Navigate to the path <b>C:\Windows\System32\inetsrv\ </b>and select <b>isapi.dll</b>. Click on Start</p> <p>g. The tool will download the public symbols of w3isapi.dll or isapi.dll to C:\Symbols folder and we are good to proceed with the rule creation</p></td></tr></tbody></table> <p>&nbsp;</p> <table cellspacing="0" cellpadding="2" width="608" border="1"> <tbody> <tr> <td valign="top" width="606">Debug Diag 2.0 Update 2 uses the symbol folder as C:\Symbols. Debug Diag 1.2 or Debug Diag 2.0 Update 1 uses the symbol folder as C:\symcache. If you have Debug Diag 1.2 or Debug Diag 2.0 Update 1 then change the file location in PDBDownloader.exe to C:\symcache. If folder does not exist please create it.</td></tr></tbody></table> <p>&nbsp;</p> <table cellspacing="0" cellpadding="2" width="610" border="1"> <tbody> <tr> <td valign="top" width="608"><b><span style="text-decoration: underline">Note</span></b>: The executable requires internet connection to download the symbols. If you don’t have internet connection on the server, then copy the <b>C:\Windows\System32\inetsrv\w3isapi.dll or </b><b>C:\Windows\System32\inetsrv\isapi.dll </b>to the machine which has internet connection and run the tool over there. Once you have the symbols downloaded, copy PDB file to the server’s symbol folder. In case of Debug Diag 1.2 or Debug Diag 2.0 Update 1<b> </b>copy it to <b>C:\Symcache</b>, else use <b>C:\Symbols</b></td></tr></tbody></table> <p>&nbsp;</p> <p>3. <b>Create a Crash Rule in Debug Diagnostic 2.0</b> with the following steps:</p> <p>a. Open Debug Diag (Start -&gt; Programs -&gt; Debug Diagnostic Tool 2.0 Collection)</p> <p>b. Select "Crash" and click Next</p> <p>c. Choose the option <b>“A specific IIS application pool”</b> and click <b>Next</b> and choose the application pool that is crashing from the list and click <b>Next. </b>(Note: The Application pool list may be empty if the <span style="text-decoration: underline">IIS 6 Metabase Compatibility</span> is not installed. In such a case you can always type the name of the application pool and click Next)</p> <p>d. Click Next in <b>Advanced Configuration (Optional), </b>click on Breakpoints and then click on <b>Add Breakpoint</b></p> <p>e. If it is a IIS 7 or higher machine then add<b> </b><b>isapi!SSFReportUnhealthy</b> and change the <b>Action Type</b> to <b>Full User Dump</b> and <b>Action Limit</b> to 5 and click on Ok.</p> <p>(OR)</p> <p>If it is a IIS 6 machine then Add <b>w3isapi!SSFReportUnhealthy </b>and change the <b>Action Type</b> to <b>Full User Dump</b> and <b>Action Limit</b> to 5 and click on Ok.</p> <p>f. Click on <b>Save and Close</b></p> <p>g. Click Next for "Rule Name". The "User dump Location" can be changed here.</p> <p>h. Select "Activate the rule now" and click Finish</p> <p>4. Notice the Status is <b>Active</b>. The User dump Count will increase each time a dump file is created.</p> <p>5. Wait for the issue to happen.</p> <p><b><span style="text-decoration: underline">Once the issue occurs</span></b></p> <p>1. The user dump count field in the Crash Rule will increment whenever the tool generates a dump. The dump will be generated in the User Dump Path</p> <p>2. You can also analyze the Dump by running Debug Diag Analysis Tool and clicking Add Data Files. When the .dmp is added, select the Crash/Hang Analyzers script and click Start Analysis. When finished, a report (.mht) will be created in C:\Program Files\DebugDiag\Reports and displayed in Internet Explorer with the results and recommendations. If using custom DLL’s, the Symbol path (Tools menu -&gt; Options and Settings -&gt; Symbol Search Path) to the custom PDB files can be added.</p> <p>&nbsp;</p> <p>Hope this helps <img class="wlEmoticon wlEmoticon-smile" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/2016/04/wlEmoticon-smile4.png"></p>]]></content:encoded>
    </item>
    <item>
      <title>Session Loss due to Application Domain Recycle-Advanced</title>
      <link>https://docs.microsoft.com/archive/blogs/webtopics/session-loss-due-to-application-domain-recycle-advanced</link>
      <pubDate>Tue, 05 Apr 2016 12:08:03 GMT</pubDate>
      <dc:creator><![CDATA[Chiranth Ramaswamy]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/webtopics/?p=1421</guid>
      <description><![CDATA[In the previous blog we had discussed regarding the basics of application domain recycling and how...]]></description>
      <content:encoded><![CDATA[<p>In the previous blog we had discussed regarding the basics of application domain recycling and how to identify if the session loss is because of app domain recycling. Over here in the below article we will discuss further on the data that we can capture to find out the root cause of application domain recycle and also how to debug the data that we have collected.</p> <p><a title="https://blogs.msdn.microsoft.com/chiranth/2015/12/14/session-loss-due-to-application-domain-recycle-advanced/" href="https://blogs.msdn.microsoft.com/chiranth/2015/12/14/session-loss-due-to-application-domain-recycle-advanced/">https://blogs.msdn.microsoft.com/chiranth/2015/12/14/session-loss-due-to-application-domain-recycle-advanced/</a></p> <p>Hope this helps <img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none;border-bottom-style: none;border-right-style: none;border-left-style: none" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/2016/04/wlEmoticon-smile3.png"></p>]]></content:encoded>
    </item>
    <item>
      <title>Session Loss due to Application Domain recycle- Basics</title>
      <link>https://docs.microsoft.com/archive/blogs/webtopics/session-loss-due-to-application-domain-recycle-basics</link>
      <pubDate>Tue, 05 Apr 2016 12:05:40 GMT</pubDate>
      <dc:creator><![CDATA[Chiranth Ramaswamy]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/webtopics/?p=1403</guid>
      <description><![CDATA[One of the very tricky issues i have seen in the recent past are session loss issues due to...]]></description>
      <content:encoded><![CDATA[<p>One of the very tricky issues i have seen in the recent past are session loss issues due to application domain recycle. The issue becomes tricky in terms of data collection and how to further look into it. In the below link i have provided more information on what is application domain recycle and how you can determine if the session loss is happening because of application domain recycling. Also i have discussed the common reasons for application domain recyling and the precautionary measures to be taken so that we don’t end up facing app domain recycling issues.</p> <p><a title="https://blogs.msdn.microsoft.com/chiranth/2015/12/14/session-loss-due-to-application-domain-recycle-basics/" href="https://blogs.msdn.microsoft.com/chiranth/2015/12/14/session-loss-due-to-application-domain-recycle-basics/">https://blogs.msdn.microsoft.com/chiranth/2015/12/14/session-loss-due-to-application-domain-recycle-basics/</a></p> <p>Hope this helps <img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none;border-bottom-style: none;border-right-style: none;border-left-style: none" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/2016/04/wlEmoticon-smile2.png"></p>]]></content:encoded>
    </item>
  </channel>
</rss>