<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>.NET at the train</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/ralarcon/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/ralarcon/feed.xml</link>
    <description>General .NET development and other thoughts written while train time</description>
    <lastBuildDate>Tue, 16 Apr 2019 05:25:25 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Build problems after upgrading from TFS2010 to TFS2012</title>
      <link>https://docs.microsoft.com/archive/blogs/ralarcon/build-problems-after-upgrading-from-tfs2010-to-tfs2012</link>
      <pubDate>Wed, 10 Apr 2013 00:47:00 GMT</pubDate>
      <dc:creator><![CDATA[Raúl Alarcón]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ralarcon/2013/04/10/build-problems-after-upgrading-from-tfs2010-to-tfs2012/</guid>
      <description><![CDATA[Recently our TFS Server have been upgraded to TFS2012 + QU1&nbsp;+ CU1. In order to be able to use...]]></description>
      <content:encoded><![CDATA[<p>Recently our TFS Server have been upgraded to TFS2012 + QU1&nbsp;+ CU1. In order to be able to use our Build Server we have had to upgrade it from TFS2010 to TFS2012 as well and, of course,&nbsp;we have found a couple issues related to the build process templates that we had defined which do not allow us to make a builds successfully.</p>
<p>I have to mention that we have only found this errors with <strong>customized </strong>build process templates (the default build process templates worked fine).</p>
<p>The <span style="text-decoration: underline;">first error</span> that we got after the upgrade has been:</p>
<p><strong><em>TF215097:</em></strong><em> An error occurred while initializing a build for build definition </em>&nbsp;\XXXX\XXXX<em>: </em></p>
<p><em>Exception Message: <strong>The root element of the build process template found</strong> at $/XXXXXX/XXX/yyyyTemplate.xaml (version C87013) <strong>is not valid</strong>. (The build process failed validation. Details: </em></p>
<p><strong><em>Validation Error</em></strong><em>: Compiler error(s) encountered processing expression "New Microsoft.TeamFoundation.Build.Workflow.Activities.BuildSettings()". </em><em>'BuildSettings' is ambiguous in the namespace 'Microsoft.TeamFoundation.Build.Workflow.Activities'.</em></p>
<p><strong><em>Validation Error</em></strong><em>: Compiler error(s) encountered processing expression "Microsoft.TeamFoundation.Build.Workflow.Activities.CleanWorkspaceOption.All". </em><em>'CleanWorkspaceOption' is ambiguous in the namespace 'Microsoft.TeamFoundation.Build.Workflow.Activities'.</em><em>&hellip;</em></p>
<p>&lt;...&gt;</p>
<p>&nbsp;</p>
<p>The solution to this error is to remove explicit references to the TFS2010 object model in the process template. I have found the solution and the explanation in this blog post (plus some code to make the cleanup process pretty simple):</p>
<p>&nbsp;<a href="https://blogs.msdn.com/b/jpricket/archive/2012/07/17/tfs-2012-cleaning-up-workflow-xaml-files-aka-removing-versioned-namespaces.aspx" target="_blank">https://blogs.msdn.com/b/jpricket/archive/2012/07/17/tfs-2012-cleaning-up-workflow-xaml-files-aka-removing-versioned-namespaces.aspx</a></p>
<p>&nbsp;</p>
<p>Then, <span style="text-decoration: underline;">the second</span> error that we got was:</p>
<p>&nbsp;</p>
<p><strong><em>TF215097:</em></strong><em> An error occurred while initializing a build for build definition \XXXX\XXXX: </em></p>
<p><em>Exception Message: <strong>The values provided for the root activity's arguments did not satisfy the root activity's requirements</strong>:</em></p>
<p><em>'DynamicActivity': Expected an input parameter value<br />of type 'Microsoft.TeamFoundation.Build.Workflow.Activities.BuildSettings' for parameter named 'BuildSettings'. </em><em>'DynamicActivity': Expected an input parameter value of type 'Microsoft.TeamFoundation.Build.Workflow.Activities.TestSpecList' for parameter named 'TestSpecs'. </em><em>Parameter name: <strong>rootArgumentValues</strong> (type ArgumentException) </em></p>
<p><em>Exception Stack Trace:&nbsp;&nbsp;&nbsp; at<br />System.Activities.Validation.ActivityValidationServices.ValidateRootInputs(Activity<br />rootActivity, IDictionary`2 inputs)</em></p>
<p>&nbsp;&nbsp; &lt;...&gt;</p>
<p>In this case, the problem was related to the fact of the build service using the previous bits of TFS object model and the solution was to remove the previous version (TFS2010) from the build server. The explanation can be found in this post:</p>
<p><a href="https://connect.microsoft.com/VisualStudio/feedback/details/775699/builds-are-failing-after-tfs2010-to-tfs2012-update1-upgrade" target="_blank">https://connect.microsoft.com/VisualStudio/feedback/details/775699/builds-are-failing-after-tfs2010-to-tfs2012-update1-upgrade</a></p>
<p>&nbsp;</p>
<p>Hope this helps!</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>SSIS, SQL Agent, Credential, Proxies and the -1073741515 process exit code</title>
      <link>https://docs.microsoft.com/archive/blogs/ralarcon/ssis-sql-agent-credential-proxies-and-the-1073741515-process-exit-code</link>
      <pubDate>Wed, 27 Feb 2013 01:55:00 GMT</pubDate>
      <dc:creator><![CDATA[Raúl Alarcón]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ralarcon/2013/02/27/ssis-sql-agent-credential-proxies-and-the-1073741515-process-exit-code/</guid>
      <description><![CDATA[Recently I have been dealing with a really weird error while trying to execute a SSIS package using...]]></description>
      <content:encoded><![CDATA[<p>Recently I have been dealing with a really weird error while trying to execute a SSIS package using a SQL Agent Job with a concrete user credential. The error that I've got was:</p>
<p><em><strong>Executed as user: XXXXX. The step did not generate any output. The return value was unknown. The process exit code was&nbsp; -1073741515. The step failed.</strong></em></p>
<p>And that's all!</p>
<p>Ok, I had in mind a hypothesis regarding the root cause: the user privilegies. The user was not managed/created by myself so the first thing I've done was to try to understand where was what the lack of permmisions?&nbsp; After some research on the error code, no relevant information was found. Then, I've converted the error code to its exadecimal equivalent and I got some information but nothing directly related to SQL Agent and SSIS. The -1073741515 is the ERROR CODE 0xC0000135 (STATUS_DLL_NOT_FOUND). It looks that the job had some issues loading DLLs...</p>
<p>Because the Job was designed to launch a SSIS package I opted to check the permissions on the <em>"C:\Program Files\Microsoft SQL Server\110\DTS\Binn"</em> folder where the DTExec.exe is located and VOILA!, the user does not had permissions to read/execute in that directory!. This lead me to understand that the user was created without being included in the "Local Users Group" of the machine where needs to run software... An error in my opinion.</p>
<p>Hope this helps!</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Useful T-SQL Scripts</title>
      <link>https://docs.microsoft.com/archive/blogs/ralarcon/useful-t-sql-scripts</link>
      <pubDate>Mon, 28 Jan 2013 00:08:00 GMT</pubDate>
      <dc:creator><![CDATA[Raúl Alarcón]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ralarcon/2013/01/28/useful-t-sql-scripts/</guid>
      <description><![CDATA[A couple of very useful and heavy used T-SQL scripts... Finally, I have decided to post both in...]]></description>
      <content:encoded><![CDATA[<p>A couple of very useful and heavy used T-SQL scripts... Finally, I have decided to post both in order to find them every time I need with out having to re-author:</p>
<p>1. Kill all existing connections to a&nbsp;certain database:</p>
<p><span style="font-family: courier new,courier;">USE master</span></p>
<p><span style="font-family: courier new,courier;">DECLARE @DataBaseName varchar(255) = '&lt;YOUR_DATABASE_NAME&gt;'</span></p>
<p><span style="font-family: courier new,courier;">DECLARE @spid INT, @cnt INT,&nbsp; @sql VARCHAR(255)</span><br /><span style="font-family: courier new,courier;">SELECT @spid = MIN(spid), @cnt = COUNT(*)&nbsp; FROM master..sysprocesses&nbsp; WHERE dbid = DB_ID(@DataBaseName) AND spid != @@SPID</span></p>
<p><span style="font-family: courier new,courier;">PRINT 'Cleaning up process...'</span><br /><span style="font-family: courier new,courier;">PRINT 'Starting to KILL '+RTRIM(@cnt)+' processes.'</span></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; <br /><span style="font-family: courier new,courier;">WHILE @spid IS NOT NULL </span><br /><span style="font-family: courier new,courier;">BEGIN </span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp; PRINT 'About to KILL '+RTRIM(@spid)&nbsp; </span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp; SET @sql = 'KILL '+RTRIM(@spid) </span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp; EXEC(@sql)&nbsp; </span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp; SELECT @spid = MIN(spid), @cnt = COUNT(*) </span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM master..sysprocesses </span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE dbid = DB_ID(@DataBaseName) </span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AND spid != @@SPID&nbsp; </span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp; PRINT RTRIM(@cnt)+' processes remain.' </span><br /><span style="font-family: courier new,courier;">END</span></p>
<p>&nbsp;</p>
<p>2. The "What's going on" query: Which are the queries are currently executed?, How much resources are using?. Very useful to understand where are the server resources spent.</p>
<p><span style="font-family: Courier New;">SELECT</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master.dbo.fn_varbintohexstr(sql_handle) + '|' + master.dbo.fn_varbintohexstr(plan_handle) +&nbsp; convert(varchar(30),statement_start_offset) + '|' + convert(varchar(30),statement_end_offset) as uniqueid,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; creation_time,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last_execution_time as last_run,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; execution_count as execs,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; total_logical_reads as logical_reads,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; total_elapsed_time as elapsed,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; total_physical_reads as phys_reads,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; total_worker_time as CPU,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; total_rows as rows,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; total_clr_time as clr,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; total_logical_writes as log_writes,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last_worker_time,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; min_worker_time,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; max_worker_time,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last_physical_reads,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; min_physical_reads,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; max_physical_reads,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last_logical_reads,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; min_logical_reads,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; max_logical_reads,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last_logical_writes,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; min_logical_writes,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; max_logical_writes,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last_clr_time,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; min_clr_time,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; max_clr_time,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last_elapsed_time,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; min_elapsed_time,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; max_elapsed_time,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last_rows,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; min_rows,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; max_rows,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; current_timestamp,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master.dbo.fn_varbintohexstr(sql_handle) as sql_handle,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; master.dbo.fn_varbintohexstr(plan_handle) as plan_handle,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; statement_start_offset,statement_end_offset,plan_generation_num,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; replace(replace(SUBSTRING(qt.text, (qs.statement_start_offset/2) + 1,</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((CASE statement_end_offset</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHEN -1 THEN DATALENGTH(qt.text)</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSE qs.statement_end_offset END</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - qs.statement_start_offset)/2) + 1),char(10),''),char(13),'') as statement_text</span><br /><span style="font-family: courier new,courier;">FROM sys.dm_exec_query_stats as qs</span><br /><span style="font-family: courier new,courier;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS qt</span><br /><span style="font-family: courier new,courier;">ORDER BY&nbsp;5 desc</span></p>
<p>&nbsp;</p>
<p>Hope this helps!</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Error 1603 installing AppFabric 1.1 for Windows Server</title>
      <link>https://docs.microsoft.com/archive/blogs/ralarcon/error-1603-installing-appfabric-1-1-for-windows-server</link>
      <pubDate>Wed, 17 Oct 2012 14:31:00 GMT</pubDate>
      <dc:creator><![CDATA[Raúl Alarcón]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ralarcon/2012/10/17/error-1603-installing-appfabric-1-1-for-windows-server/</guid>
      <description><![CDATA[I been dealing for some time with an error installing AppFabric 1.1. for Windows Server. All started...]]></description>
      <content:encoded><![CDATA[<p>I been dealing for some time with an error installing AppFabric 1.1. for Windows Server. All started when, after having AppFabric installed my laptop runs in a System Restore after having updated the video driver. The restore puts my system in a previous state where the installation of AppFabric isn't exists.&nbsp;</p>
<p>After that, I've tried to re-install AppFabric with the surprise of getting the following error: Microsoft.ApplicationServer.Setup.Core.SetupException: AppFabric installation failed because installer MSI returned with error code : 1603</p>
<p>I've research on the error but most of the information found leads me to re-install the .NET Frameworks (all versions). Wrong.</p>
<p>Finally, keeping more attention to the MSI error I've found within&nbsp;the following post <span name="subject"><a title="https://social.msdn.microsoft.com/Forums/en/velocity/thread/561f3ad4-14ef-4d26-b79a-bef8e1376d64?prof=required" href="https://blogs.msdn.com/controlpanel/blogs/posteditor.aspx/MSI Error 1603 installing AppFabric 1.1 / Win7 x64">MSI Error 1603 installing AppFabric 1.1 / Win7 x64</a>&nbsp;which have correct the solution. I Have to say that&nbsp;the title is better than the content, in fact, I've pass over this post initially but does not look&nbsp;to&nbsp;have the solution, that was at the end of the thread. </span></p>
<p><span name="subject">The problem was that the "system restore" do not have removed the "PSModulePath" environment variable and the installation fails because it already exists!. </span><span name="subject">Really simple solution, remove it.</span></p>
<p><span name="subject"></span>&nbsp;</p>
<p><span name="subject"></span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Web App Performance Counters Compilation</title>
      <link>https://docs.microsoft.com/archive/blogs/ralarcon/web-app-performance-counters-compilation</link>
      <pubDate>Tue, 02 Oct 2012 22:54:00 GMT</pubDate>
      <dc:creator><![CDATA[Raúl Alarcón]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ralarcon/2012/10/02/web-app-performance-counters-compilation/</guid>
      <description><![CDATA[In order measure the performance of a common web application (a web frontend connected to a database...]]></description>
      <content:encoded><![CDATA[<p lang="en-US">In order measure the performance of a common web application (a web frontend connected to a database server), to which performance counters we have to pay attention?. If we are trying to diagnose a performance problem, where to start?. What does each performance counter means? When I have to get worried by a specific counter?&nbsp;</p>
<p lang="en-US">Well, there are hundreds of performance counters available, most of them related with others, and could be a little bit tricky to select which counters we want to gather. The performance of any application will be determined by the throughput of following computing elements: CPU, Memory, IO and Network. At the same time, this means that if we have an application not performing well, the bottlenecks&nbsp; will be located in one or more of these elements. So, these are the elements that, in general, we have to monitor in any machine where our application is deployed.</p>
<p lang="en-US">Then, each of the machines involved in the application deployment plays a different role, so different counters must be gathered in each one. Our sample web application is using a web frontend and a database server, so we need to pay attention to specific counters to each of these roles.</p>
<p lang="en-US">Following, I&nbsp;have gathered from different sources a compilation of performance counters and their meanings that can be used as starting point to measure the performance or diagnose an issue in your web application. There are three different blocks: <a title="General Counters" href="#GeneralCounters">General Counters</a>, <a title="Web Server Counters" href="#WebServerCounters">Web Server Counters</a> and <a title="SQL Counters" href="#SQLCounters">SQL Server Counters</a>.</p>
<h3 lang="en-AU"><a name="GeneralCounters"></a>General Counters</h3>
<p lang="en-AU">Counters to be gathered in all servers.</p>
<div>
<table border="1" cellspacing="0" cellpadding="3" valign="top">
<tbody>
<tr>
<td>
<p lang="en-GB">Category</p>
</td>
<td>
<p lang="en-GB">Object/Counter</p>
</td>
<td>
<p lang="en-GB">Description</p>
</td>
<td>
<p lang="en-GB">Recommendations</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">Processor</p>
</td>
<td>
<p lang="en-GB">Processor : % Processor Time</p>
</td>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">Processor : % Total User Time</p>
</td>
<td>
<p lang="en-GB">The value of this counter helps to determine the kind of&nbsp; processing that is affecting the system. Of course the resulting value is the&nbsp; total amount of non-idle time that was spent on User mode operations. This&nbsp; generally means application code.</p>
</td>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">System : % Total Privileged Time</p>
</td>
<td>
<p lang="en-GB">This is the amount of time the processor was busy with&nbsp; Kernel mode operations. If the processor is very busy and this mode is high,&nbsp; it is usually an indication of some type of NT service having difficulty,&nbsp; although user mode programs can make calls to the Kernel mode NT components&nbsp; to occasionally cause this type of performance issue.</p>
</td>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">System : Processor Queue Length</p>
</td>
<td>
<p lang="en-GB">Oddly enough, this processor counter shows up under the&nbsp; System object, but not without good reason. There is only 1 queue for tasks&nbsp; that need to go to the processor, even if there is more than one CPU</p>
</td>
<td>
<p lang="en-GB">The resulting value is a measure of how many threads are in&nbsp; the Ready state waiting to be processed. When dealing with queues, if the&nbsp; value exceeds 2 for a sustained period, you are definitely having a problem&nbsp; with the resource in question.</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">Memory</p>
</td>
<td>
<p lang="en-GB">Memory\Pages/sec</p>
</td>
<td>
<p lang="en-GB">The number of pages read from or written to disk to resolve&nbsp; hard page faults. This counter serves as a primary indicator of the types of&nbsp; faults that cause system-wide delays.</p>
</td>
<td>
<p lang="en-GB">Although it is normal to have some spikes, this counter&nbsp; generally remains at or close to zero</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">Memory : Page Faults/sec</p>
</td>
<td>
<p lang="en-GB">This counter gives a general idea of how many times&nbsp; information being requested is not where the application (and VMM) expects it&nbsp; to be. The information must either be retrieved from another location in&nbsp; memory or from the pagefile.</p>
</td>
<td>
<p lang="en-GB">Recall that while a sustained value may indicate trouble&nbsp; here, you should be more concerned with hard page faults that represent&nbsp; actual reads or writes to the disk. Remember that the disk access is much&nbsp; slower than RAM.</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">Memory : Page Reads/sec</p>
</td>
<td>
<p lang="en-GB">This counter is probably the best indicator of a memory&nbsp; shortage because it indicates how often the system is reading from disk&nbsp; because of hard page faults. The system is always using the pagefile even if&nbsp; there is enough RAM to support all of the applications. Thus, some number of&nbsp; page reads will always be encountered</p>
</td>
<td>
<p lang="en-GB">A sustained value over 5 Page Reads/sec is often a strong&nbsp; indicator of a memory shortage. You must be careful about viewing these&nbsp; counters to understand what they are telling you. This counter again&nbsp; indicates the number of reads from the disk that were done to satisfy page&nbsp; faults. The amount of pages read each time the system went to the disk may&nbsp; indeed vary. This will be a function of the application and the proximity of&nbsp; the data on the hard drive. Irrelevant of these facts, a sustained value of&nbsp; over 5 is still a strong indicator of a memory problem. Remember the&nbsp; importance of "sustained." System operations often fluctuate,&nbsp; sometimes widely. So, just because the system has a Page Reads/sec of 24 for&nbsp; a couple of seconds does not mean you have a memory shortage</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">Memory : Page Writes/sec</p>
</td>
<td>
<p lang="en-GB">Much like the Page Reads/sec, this counter indicates how&nbsp; many times the disk was written to in an effort to clear unused items out of&nbsp; memory</p>
</td>
<td>
<p lang="en-GB">The numbers of pages per read may change. Increasing values&nbsp; in this counter often indicate a building tension in the battle for memory&nbsp; resources</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">Memory : Available MB</p>
</td>
<td>
<p lang="en-GB">This counter indicates the amount of memory that is left&nbsp; after nonpaged pool allocations, paged pool allocations, process' working&nbsp; sets, and the file system cache have all taken their piece</p>
</td>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">Disk</p>
</td>
<td>
<p lang="en-GB">PhysicalDisk : Current Disk Queue Length</p>
</td>
<td>
<p lang="en-GB">This counter provides a primary measure of disk congestion.&nbsp; Just as the processor queue was an indication of waiting threads, the disk&nbsp; queue is an indication of the number of transactions that are waiting to be&nbsp; processed.</p>
</td>
<td>
<p lang="en-GB">Recall that the queue is an important measure for services&nbsp; that operate on a transaction basis. Just like the line at the supermarket,&nbsp; the queue will be representative of not only the number of transactions, but&nbsp; also the length and frequency of each transaction</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">PhysicalDisk : % Disk Time</p>
</td>
<td>
<p lang="en-GB">Much like % Processor time, this counter is a general mark&nbsp; of how busy the disk is. You will see many similarities between the disk and&nbsp; processor since they are both transaction-based services</p>
</td>
<td>
<p lang="en-GB">This counter indicates a disk problem, but must be observed&nbsp; in conjunction with the Current Disk Queue Length counter to be truly&nbsp; informative. Recall also that the disk could be a bottleneck prior to the %&nbsp; Disk Time reaching 100%.</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">PhysicalDisk : Avg. Disk Queue Length</p>
</td>
<td>
<p lang="en-GB">This counter is actually strongly related to the %Disk Time&nbsp; counter. This counter converts the %Disk Time to a decimal value and displays&nbsp; it. This counter will be needed in times when the disk configuration employs&nbsp; multiple controllers for multiple physical disks. In these cases, the overall&nbsp; performance of the disk I/O system, which consists of two controllers, could&nbsp; exceed that of an individual disk.</p>
</td>
<td>
<p lang="en-GB">&nbsp;If you were looking&nbsp; at the %Disk Time counter, you would only see a value of 100%, which wouldn't&nbsp; represent the total potential of the entire system, but only that it had&nbsp; reached the potential of a single disk on a single controller. The real value&nbsp; may be 120% which the Avg. Disk Queue Length counter would display as 1.2.</p>
<p lang="en-GB">&nbsp;</p>
<p lang="en-GB">The number of requests should not exceed two times the&nbsp; number of spindles constituting the physical disk. If the number of requests&nbsp; is too high, you can add additional disks or replace the existing disks with&nbsp; faster disks.</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">PhysicalDisk: Disk Transfers/sec</p>
</td>
<td>
<p lang="en-GB">The rates of read and write operations on the disk. Define&nbsp; a counter for each physical disk on the server.</p>
</td>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">Network</p>
</td>
<td>
<p lang="en-GB">Network Interface\Bytes total/sec</p>
</td>
<td>
<p lang="en-GB">Number of bytes traveling over the network interface per&nbsp; second. This counter only reflects the local network connection.</p>
</td>
<td>
<p lang="en-GB">If this value stays below 50 percent of your available&nbsp; network bandwidth, the network adapter on the server running SQL Server 2000&nbsp; is not likely to cause any performance bottlenecks.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p lang="en-US">&nbsp;</p>
<h3 lang="en-US"><a name="WebServerCounters"></a>Web Server Counters</h3>
<p lang="en-US">Counters to be gathered in the servers acting as web frontend in addition to the general counters.</p>
<div>
<table border="1" cellspacing="0" cellpadding="3" valign="top">
<tbody>
<tr>
<td>
<p lang="en-GB">Category</p>
</td>
<td>
<p lang="en-US">Object/Counter</p>
</td>
<td>
<p lang="en-US">Description</p>
</td>
<td>
<p lang="en-US">Recommendations</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">Process</p>
</td>
<td>
<p lang="en-US">Process(aspnet_wp)\% Processor Time</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">Process(aspnet_wp)\ Private Bytes</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">Process(aspnet_wp)\ Virtual Bytes</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">Process(aspnet_wp)\ Handle Count</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">.NET</p>
</td>
<td>
<p lang="en-US">.NET CLR Exceptions\# Exceps thrown / sec</p>
</td>
<td>
<p lang="en-US">The total number of managed exceptions thrown per second</p>
</td>
<td>
<p lang="en-US">As this number increases, performance degrades. Exceptions&nbsp; should not be thrown as part of normal processing. Note, however, that&nbsp; Response.Redirect, Server.Transfer, and Response.End all cause a&nbsp; ThreadAbortException to be thrown multiple times, and a site that relies&nbsp; heavily upon these methods will incur a performance penalty. If you must use&nbsp; Response.Redirect, call Response.Redirect(url, false), which does not call&nbsp; Response.End, and hence does not throw. The downside is that the user code&nbsp; that follows the call to Response.Redirect(url, false) will execute. It is&nbsp; also possible to use a static HTML page to redirect. Microsoft Knowledge Base&nbsp; Article 312629 provides further detail.</p>
<p lang="en-US">&nbsp;</p>
<p lang="en-US">Threshold: 5% of RPS. Values greater than this should be&nbsp; investigated, and a new threshold should be set as necessary</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">.NET CLR Security(_Global_)\% Time in RT checks</p>
</td>
<td>
<p lang="en-US">Displays the percentage of elapsed time spent performing&nbsp; runtime code access security checks since the last sample. This counter is&nbsp; updated at the end of a .NET Framework security check. It is not an average;&nbsp; it represents the last observed value</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">.NET CLR Memory\% Time in GC</p>
</td>
<td>
<p lang="en-US">The percentage of time spent performing the last garbage&nbsp; collection. An average value of 5% or less would be considered healthy, but&nbsp; spikes larger than this are not uncommon. Note that all threads are suspended&nbsp; during a garbage collection</p>
</td>
<td>
<p lang="en-US">Threshold: an average of 5% or less; short-lived spikes&nbsp; larger than this are common. Average values greater than this should be&nbsp; investigated. A new threshold should be set as necessary</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">ASP.NET</p>
</td>
<td>
<p>ASP.NET\Application Restarts</p>
</td>
<td>
<ul>
<ul>&nbsp;&nbsp;</ul>
</ul>
<p lang="en-US">&nbsp;The number of&nbsp;&nbsp; application restarts. Recreating the application domain and recompiling&nbsp;&nbsp; pages takes time, therefore unforeseen application restarts should be&nbsp;&nbsp; investigated. The application domain is unloaded when one of the following&nbsp;&nbsp; occurs:</p>
<ul>&nbsp;&nbsp;
<ul>&nbsp;&nbsp;&nbsp;
<li lang="en-US">Modification of machine.config, web.config, or&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; global.asax.</li>
&nbsp;&nbsp;&nbsp;
<li lang="en-US">Modification of the application's bin directory or its&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; contents.</li>
&nbsp;&nbsp;&nbsp;
<li lang="en-US">When the number of compilations (ASPX, ASCX, or ASAX)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exceeds the limit specified by &lt;compilation&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; numRecompilesBeforeAppRestart=/&gt;.</li>
&nbsp;&nbsp;&nbsp;
<li lang="en-US">Modification of the physical path of a virtual&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; directory.</li>
&nbsp;&nbsp;&nbsp;
<li lang="en-US">Modification of the code-access security policy.</li>
&nbsp;&nbsp;&nbsp;
<li lang="en-US">The Web service is restarted.</li>
&nbsp;&nbsp;</ul>
</ul>
</td>
<td>
<p lang="en-US">Threshold: 0. In a perfect world, the application domain&nbsp; will survive for the life of the process. Excessive values should be&nbsp; investigated, and a new threshold should be set as necessary.</p>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p>ASP.NET\Requests Rejected</p>
</td>
<td>
<p lang="en-US">The number of request currently rejected</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">ASP.NET\Worker Process Restarts</p>
</td>
<td>
<p lang="en-US">The number of aspnet_wp process restarts.</p>
</td>
<td>
<p lang="en-US">Threshold: 1. Process restarts are expensive and&nbsp; undesirable. Values are dependent upon the process model configuration&nbsp; settings, as well as unforeseen access violations, memory leaks, and&nbsp; deadlocks. If aspnet_wp restarts, an Application Event Log entry will&nbsp; indicate why. Requests will be lost if an access violation or deadlock&nbsp; occurs. If process model settings are used to preemptively recycle the&nbsp; process, it will be necessary to set an appropriate threshold.</p>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">ASP.NET\Request Execution Time</p>
</td>
<td>
<p lang="en-US">The number of milliseconds taken to execute the last&nbsp; request. In version 1.0 of the Framework, the execution time begins when the&nbsp; worker process receives the request, and stops when the ASP.NET ISAPI sends&nbsp; HSE_REQ_DONE_WITH_SESSION to IIS. For IIS version 5, this includes the time&nbsp; taken to write the response to the client, but for IIS version 6, the&nbsp; response buffers are sent asynchronously, and so the time taken to write the&nbsp; response to the client is not included. Thus on IIS version 5, a client with&nbsp; a slow network connection will increase the value of this counter&nbsp; considerably.</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p>ASP.NET\Requests Current</p>
</td>
<td>
<p lang="en-US">The number of requests currently handled by the ASP.NET&nbsp; ISAPI. This includes those that are queued, executing, or waiting to be&nbsp; written to the client</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p>ASP.NET\Request Queued</p>
</td>
<td>
<p lang="en-US">The number of requests currently queued</p>
</td>
<td>
<p lang="en-US">Threshold: 0. The value of this counter should be 0. Values&nbsp; greater than this should be investigated</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">ASP.NET\Request Wait Time</p>
</td>
<td>
<p lang="en-US">The number of milliseconds that the most recent request&nbsp; spent waiting in the queue, or named pipe, that exists between inetinfo and&nbsp; aspnet_wp (see description of Requests Queued). This does not include any&nbsp; time spent waiting in the application queues.</p>
</td>
<td>
<p lang="en-US">Threshold: 1000. The average request should spend 0&nbsp; milliseconds waiting in the queue.</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">ASP.NET Applications(__Total__)\Requests Total</p>
</td>
<td>
<p lang="en-US">The number of requests since the application was started</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">ASP.NET Applications(__Total__)\Requests/Sec</p>
</td>
<td>
<p lang="en-US">The number of requests executed per second. I prefer&nbsp; "Web Service\ISAPI Extension Requests/sec" because it is not&nbsp; affected by application restarts</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">ASP.NET Applications(__Total__)\Errors Total</p>
</td>
<td>
<p lang="en-US">The sum of Errors During Preprocessing, Errors During&nbsp; Compilation, and Errors During Execution</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">ASP.NET Applications(__Total__)\Errors Total/Sec</p>
</td>
<td>
<p lang="en-US">The total of Errors During Preprocessing, Errors During&nbsp; Compilation, and Errors During Execution per second.</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">ASP.NET Applications(__Total__)\Cache API Entries</p>
</td>
<td>
<p lang="en-US">The number of entries currently in the user cache.</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">ASP.NET Applications(__Total__)\Cache API Hit Ratio</p>
</td>
<td>
<p lang="en-US">The total hit-to-miss ratio of User Cache requests.</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">ASP.NET Applications(__Total__)\Cache API Turnover Rate</p>
</td>
<td>
<p lang="en-US">The number of additions and removals to the user cache per&nbsp; second. A high turnover rate indicates that items are being quickly added and&nbsp; removed, which can be expensive.</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">ASP.NET Applications(__Total__)\Cache Total Entries</p>
</td>
<td>
<p lang="en-US">The current number of entries in the cache (both User and&nbsp; Internal). Internally, ASP.NET uses the cache to store objects that are&nbsp; expensive to create, including configuration objects, preserved assembly&nbsp; entries, paths mapped by the MapPath method, and in-process session state&nbsp; objects.</p>
</td>
<td>
<p lang="en-US">Note&nbsp;&nbsp; The&nbsp; "Cache Total" family of performance counters is useful for&nbsp; diagnosing issues with in-process session state. Storing too many objects in&nbsp; the cache is often the cause of memory leaks</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">ASP.NET Applications(__Total__)\Cache Total Hit Ratio</p>
</td>
<td>
<p lang="en-US">The number of additions and removals to the cache per&nbsp; second (both user and internal). A high turnover rate indicates that items&nbsp; are being quickly added and removed, which can be expensive.</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">ASP.NET Applications(__Total__)\Cache Total&nbsp;&nbsp;&nbsp;&nbsp; Turnover Rate</p>
</td>
<td>
<p lang="en-US">The number of additions and removals to the user cache per&nbsp; second. A high turnover rate indicates that items are being quickly added and&nbsp; removed, which can be expensive.</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">IIS</p>
</td>
<td>
<p lang="en-US">Web Service(_Total)\Current Connections</p>
</td>
<td>
<p>A threshold for this counter is dependent upon many&nbsp; variables, such as the type of requests (ISAPI, CGI, static HTML, and so on),&nbsp; CPU utilization, and so on. A threshold should be&nbsp; developed through experience.</p>
</td>
<td>
<p>&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-US">Web Service(_Total)\ISAPI Extension Requests/sec</p>
</td>
<td>
<p lang="en-US">Used primarily as a metric for diagnosing performance&nbsp; issues. It can be interesting to compare this with "ASP.NET&nbsp; Applications\Requests/sec" and "Web Service\Total Method&nbsp; Requests/sec." Note that this includes requests to all ISAPI extensions,&nbsp; not just aspnet_isapi.dll</p>
</td>
<td>
<p lang="en-US">&nbsp;</p>
</td>
</tr>
</tbody>
</table>
</div>
<p lang="en-US">&nbsp;</p>
<h3 lang="en-US"><a name="SQLCounters"></a>SQL Server Counters</h3>
<p lang="en-US">Counters to be gathered in the servers hosting the SQL Server service in addition to the general counters.</p>
<div>
<table border="1" cellspacing="0" cellpadding="3" valign="top">
<tbody>
<tr>
<td>
<p lang="en-GB">Category</p>
</td>
<td>
<p lang="en-GB">Object/Counter</p>
</td>
<td>
<p lang="en-GB">Description</p>
</td>
<td>
<p lang="en-GB">Recommendations</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">SQL Server</p>
</td>
<td>
<p lang="en-GB">SQLServer:Memory Manager\Total Server Memory</p>
</td>
<td>
<p lang="en-GB">The total memory in use by SQL</p>
</td>
<td>
<p lang="en-GB">Add memory to the server if this value is generally higher&nbsp; than the amount of physical memory in the server.</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">SQLServer:Access Methods\Full Scans/sec</p>
</td>
<td>
<p lang="en-GB">The number of unrestricted full scans. These can either be&nbsp; base table or full index scans.</p>
</td>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">SQLServer:Buffer Manager\Buffer Cache Hit Ratio</p>
</td>
<td>
<p lang="en-GB">The percentage of pages that were found in the buffer pool&nbsp; without having to incur a read from disk.</p>
</td>
<td>
<p lang="en-GB">When this percentage is high, your server is operating at&nbsp; optimal disk I/O efficiency. If this value decreases over time, you might&nbsp; consider adding physical memory to your server.</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">SQLServer:Databases\Log Growths</p>
</td>
<td>
<p lang="en-GB">The total number of log growths for the selected database.</p>
</td>
<td>
<p lang="en-GB">Run against your application database instance</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">SQLServer:Databases Application Database\Percent Log Used</p>
</td>
<td>
<p lang="en-GB">The percent of space in the log that is in use.</p>
</td>
<td>
<p lang="en-GB">Run against your application database instance</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">SQLServer:Databases Application Database\Transactions/sec</p>
</td>
<td>
<p lang="en-GB">The number of transactions started for the database.</p>
</td>
<td>
<p lang="en-GB">Run against your application database instance.</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">SQLServer:General Statistics\User Connections</p>
</td>
<td>
<p lang="en-GB">The number of users connected to the system.</p>
</td>
<td>
<p lang="en-GB">Research any dramatic shifts in this value</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">SQLServer:Latches\Average Latch Wait Time</p>
</td>
<td>
<p lang="en-GB">The average latch wait time, in milliseconds, for latch&nbsp; requests that had to wait.</p>
</td>
<td>
<p lang="en-GB">If this number is high, your server might have resource&nbsp; limitations.</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">SQLServer:Locks\Average Wait Time</p>
</td>
<td>
<p lang="en-GB">The average amount of wait time, in milliseconds, for each&nbsp; lock request that resulted in a wait.</p>
</td>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">SQLServer:Locks\Lock Waits/sec</p>
</td>
<td>
<p lang="en-GB">The number of lock requests that could not be satisfied&nbsp; immediately and required the caller to wait before the lock was granted.</p>
</td>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">SQLServer:Locks\Number of Deadlocks/sec</p>
</td>
<td>
<p lang="en-GB">The number of lock requests that resulted in a deadlock.</p>
</td>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">SQLServer:Memory Manager\Memory Grants Pending</p>
</td>
<td>
<p lang="en-GB">The current number of processes waiting for a workspace&nbsp; memory grant.</p>
</td>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">SQLServer: SQL Statistics: Batch Requests/Sec</p>
</td>
<td>
<p lang="en-GB">This counter measures the number of batch requests that SQL&nbsp; Server receives per second, and generally follows in step to how busy your&nbsp; server&rsquo;s CPUs are</p>
</td>
<td>
<p lang="en-GB">Generally speaking, over 1000 batch requests per second&nbsp; indicates a very busy SQL Server, and could mean that if you are not already&nbsp; experiencing a CPU bottleneck, that you may very well soon. Of course, this&nbsp; is a relative number, and the bigger your hardware, the more batch requests&nbsp; per second SQL Server can handle.</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">SQLServer: SQL Statistics: SQL Compilations/Sec</p>
</td>
<td>
<p lang="en-GB">How many compilations are performed by SQL Server per&nbsp; second</p>
</td>
<td>
<p lang="en-GB">If you find that your server is performing over 100&nbsp; compilations per second, you should take the time to investigate if the cause&nbsp; of this is something that you can control. Too many compilations will hurt&nbsp; your SQL Server&rsquo;s performance</p>
</td>
</tr>
<tr>
<td>
<p lang="en-GB">&nbsp;</p>
</td>
<td>
<p lang="en-GB">SQLServer: SQL Statistics: SQL Re-Compilations/Sec</p>
</td>
<td>
<p lang="en-US">Number of statement recompiles per second. Counts the&nbsp; number of times statement recompiles are triggered.</p>
</td>
<td>
<p lang="en-US">Generally, you want the recompiles to be low</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>IP Lockdown en Web Roles de Azure</title>
      <link>https://docs.microsoft.com/archive/blogs/ralarcon/ip-lockdown-en-web-roles-de-azure</link>
      <pubDate>Tue, 05 Jun 2012 08:43:29 GMT</pubDate>
      <dc:creator><![CDATA[Raúl Alarcón]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ralarcon/2012/06/05/ip-lockdown-en-web-roles-de-azure/</guid>
      <description><![CDATA[En el proyecto actual hemos tenido la necesidad de limitar el acceso los Web Roles de manera que...]]></description>
      <content:encoded><![CDATA[<p>En el proyecto actual hemos tenido la necesidad de limitar el acceso los Web Roles de manera que sólo determinadas IPs pueden alcanzar el sitio web público. Básicamente se trata de limitar la superficie de exposición de la aplicación ya que el objetivo de la solución desarrollada no es de ámbito global si no local (se podría decir que es una aplicación de Intranet).</p>  <p>Si se busca en la web sobre “direcciones IPs, restricción y Azure”, puede ser que se llegue a encontrar algo sobre “<a href="https://msdn.microsoft.com/en-us/library/windowsazure/gg557551.aspx" target="_blank">NetworkTrafficRules</a>” que en realidad no es lo que estamos buscando. Esta característica sirve para identificar qué roles pueden comunicarse con determinados “End Points”, esto es, se limita al tráfico interno dentro de los data centers de Azure.</p>  <p>Lo que buscamos está relacionado con la característica de IIS de restricción de IPs y Dominios.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/88/84/metablogapi/5556.image_8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-88-84-metablogapi/5556.image_5F00_8.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/88/84/metablogapi/0675.image_thumb_2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-88-84-metablogapi/0675.image_5F00_thumb_5F00_2.png" width="91" height="108" /></a></p>  <p>Para resolver este problema, hemos utilizado la siguiente aproximación:</p>  <ol>   <li>Habilitar la restricción de IPs y dominios de IIS en los Web Roles.</li>    <li>Definir, en el servicio (.csdef), un nuevo elemento que contenga la lista de IPs admitidas.</li>    <li>Aplicar las restricciones cuando el Web Role arranca o cuando hay cambios en la configuración.</li> </ol>  <p>Para ello, hemos creado un script que habilita en el IIS del Web Role la característica de restricción de IPs y dominios (que, por defecto, en las máquinas de Azure no está habilitada):</p>  <div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);" id="codeSnippetWrapper">   <div style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);" id="codeSnippet">     <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">@echo off</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">@echo Installing “IP Address and Domain Restrictions” feature</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">%windir%\System32\ServerManagerCmd.exe -install Web-IP-Security</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">@echo Unlocking configuration for “IP Address and Domain Restrictions” feature</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">%windir%\system32\inetsrv\AppCmd.exe unlock config -section:system.webServer/security/ipSecurity</pre>
<!--CRLF--></div>
</div>

<p>Luego, utilizamos el script referenciándolo en una “<a href="https://msdn.microsoft.com/en-us/library/windowsazure/gg456327.aspx" target="_blank">Startup Task</a>” (tarea que se ejecuta al iniciar el Role en Azure). </p>

<div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);" id="codeSnippetWrapper">
  <div style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);" id="codeSnippet">
    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">WebRole</span> <span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">=&quot;RoleName&quot;</span> <span style="color: rgb(255, 0, 0);">vmsize</span><span style="color: rgb(0, 0, 255);">=&quot;Medium&quot;</span><span style="color: rgb(0, 0, 255);">&gt;</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">  <span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">Startup</span><span style="color: rgb(0, 0, 255);">&gt;</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    <span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">Task</span> <span style="color: rgb(255, 0, 0);">executionContext</span><span style="color: rgb(0, 0, 255);">=&quot;elevated&quot;</span> <span style="color: rgb(255, 0, 0);">commandLine</span><span style="color: rgb(0, 0, 255);">=&quot;startup/enableIpRestrictions.cmd&quot;</span> <span style="color: rgb(0, 0, 255);">/&gt;</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">  <span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">Startup</span><span style="color: rgb(0, 0, 255);">&gt;</span></pre>
<!--CRLF--></div>
</div>

<p>Después definimos un nuevo “setting” en la definición del servicio (.csdef):</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/88/84/metablogapi/5543.image_6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-88-84-metablogapi/5543.image_5F00_6.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/88/84/metablogapi/6136.image_thumb_1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-88-84-metablogapi/6136.image_5F00_thumb_5F00_1.png" width="451" height="92" /></a></p>

<p>Con, por ejemplo, el siguiente valor asociado:</p>

<div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);" id="codeSnippetWrapper">
  <div style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);" id="codeSnippet">
    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">Setting</span> <span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">=&quot;ipRestrictions&quot;</span> <span style="color: rgb(255, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">=&quot;127.0.0.1,,true;192.168.100.0,255.255.255.0,true;192.205.205.1,,true&quot;</span> <span style="color: rgb(0, 0, 255);">/&gt;</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">&#160;</pre>
<!--CRLF--></div>
</div>

<p>El elemento de configuración acepta valores que describen una IP concreta o un rango de IPs y si está permitida o no. Por defecto, toda comunicación que provenga de una IP que esté definida, es rechaza (a menos que el valor esté vacío). El formato que se acepta se podría definir como:</p>

<p align="center"><strong>&lt;<em>IP</em>&gt;&lt;<em>Subnet Mask</em>&gt;&lt;true|false&gt;[,&lt;<em>IP</em>&gt;&lt;<em>Subnet Mask</em>&gt;&lt;true|false&gt;[,…]]</strong></p>

<p align="left">A continuación, viene la parte más compleja: el método que modifica la configuración de IIS en base a los valores establecidos en <strong><em>ipRestrictions. </em></strong>Este método<em>&#160;</em>se basa en el uso de la clase <a href="https://msdn.microsoft.com/en-us/library/microsoft.web.administration.servermanager(v=VS.90).aspx" target="_blank">ServerManager</a>.<strong><em>&#160;</em></strong>Le hemos llamado “EnableIPRestrictions()”:</p>

<div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);" id="codeSnippetWrapper">
  <div style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);" id="codeSnippet">
    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span style="color: rgb(0, 0, 255);">public</span> <span style="color: rgb(0, 0, 255);">static</span> <span style="color: rgb(0, 0, 255);">void</span> EnableIpRestrictions()</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">{</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    <span style="color: rgb(0, 0, 255);">string</span> msg =  <span style="color: rgb(0, 96, 128);">&quot;Habilitando restricciones por IP.&quot;</span>;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    EventLog.WriteEntry(EVENT_LOG_SOURCE, msg, EventLogEntryType.Information, 2000);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    Trace.TraceInformation(msg);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    <span style="color: rgb(0, 0, 255);">try</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    {</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        <span style="color: rgb(0, 0, 255);">using</span> (ServerManager serverManager = <span style="color: rgb(0, 0, 255);">new</span> ServerManager())</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        {</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            Microsoft.Web.Administration.Configuration config = serverManager.GetApplicationHostConfiguration();</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">            ConfigurationSection ipSecuritySection = config.GetSection(<span style="color: rgb(0, 96, 128);">&quot;system.webServer/security/ipSecurity&quot;</span>);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            ipSecuritySection[<span style="color: rgb(0, 96, 128);">&quot;allowUnlisted&quot;</span>] = <span style="color: rgb(0, 0, 255);">false</span>;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            ConfigurationElementCollection ipSecurityCollection = ipSecuritySection.GetCollection();</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">            ConfigurationElement ipClearElement = ipSecurityCollection.CreateElement(<span style="color: rgb(0, 96, 128);">&quot;clear&quot;</span>);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            ipSecurityCollection.Add(ipClearElement);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            <span style="color: rgb(0, 0, 255);">string</span> ipRestrictionsConfigValue = RoleEnvironment.GetConfigurationSettingValue(<span style="color: rgb(0, 96, 128);">&quot;ipRestrictions&quot;</span>);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">            <span style="color: rgb(0, 0, 255);">if</span> (!String.IsNullOrWhiteSpace(ipRestrictionsConfigValue))</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            {</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">                Trace.TraceInformation(String.Format(<span style="color: rgb(0, 96, 128);">&quot;Valor de configuración del servicio para \&quot;ipRestrictions\&quot;: {0}&quot;</span>, ipRestrictionsConfigValue));</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">                IPRestrictionList ipList = <span style="color: rgb(0, 0, 255);">new</span> IPRestrictionList(ipRestrictionsConfigValue);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">                <span style="color: rgb(0, 0, 255);">foreach</span> (IPRestriction ipDefinition <span style="color: rgb(0, 0, 255);">in</span> ipList)</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">                {</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">                    Trace.TraceInformation(String.Format(<span style="color: rgb(0, 96, 128);">&quot;Añadiendo restricción: {0}&quot;</span>, ipDefinition.ToString()));</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">                    ConfigurationElement ipSecurityElement = ipSecurityCollection.CreateElement(<span style="color: rgb(0, 96, 128);">&quot;add&quot;</span>);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">                    ipSecurityElement[<span style="color: rgb(0, 96, 128);">&quot;ipAddress&quot;</span>] = ipDefinition.IP.ToString();</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">                    <span style="color: rgb(0, 0, 255);">if</span> (ipDefinition.Mask != <span style="color: rgb(0, 0, 255);">null</span>)</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">                    {</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">                        ipSecurityElement[<span style="color: rgb(0, 96, 128);">&quot;subnetMask&quot;</span>] = ipDefinition.Mask.ToString();</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">                    }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">                    ipSecurityElement[<span style="color: rgb(0, 96, 128);">&quot;allowed&quot;</span>] = ipDefinition.Allowed.ToString();</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">                    ipSecurityCollection.Add(ipSecurityElement);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">                    Trace.TraceInformation(String.Format(<span style="color: rgb(0, 96, 128);">&quot;Restricción añadida a la colección: {0}&quot;</span>, ipDefinition.ToString()));</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">                }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">            }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            <span style="color: rgb(0, 0, 255);">else</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">            {</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">                ipSecuritySection[<span style="color: rgb(0, 96, 128);">&quot;allowUnlisted&quot;</span>] = <span style="color: rgb(0, 0, 255);">true</span>;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">                Trace.TraceInformation(<span style="color: rgb(0, 96, 128);">&quot;No se han definido restricciones de IP.&quot;</span>);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            serverManager.CommitChanges();</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">            Trace.TraceInformation(String.Format(<span style="color: rgb(0, 96, 128);">&quot;Cambios de configuración guardados correctamente&quot;</span>));</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">            msg = <span style="color: rgb(0, 96, 128);">&quot;Restricciones (si las había) aplicadas correctamente.&quot;</span>;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            EventLog.WriteEntry(EVENT_LOG_SOURCE, msg, EventLogEntryType.Information, 2005);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">            Trace.TraceInformation(msg);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    <span style="color: rgb(0, 0, 255);">catch</span> (Exception ex)</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    {</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        <span style="color: rgb(0, 0, 255);">string</span> message = <span style="color: rgb(0, 96, 128);">&quot;Se produjo un error habilitando las restricciones por IP. Excepción: &quot;</span> + ex.ToString();</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        EventLog.WriteEntry(EVENT_LOG_SOURCE, message, EventLogEntryType.Error, 2100);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        Trace.TraceError(message);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        <span style="color: rgb(0, 0, 255);">throw</span>;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">}</pre>
<!--CRLF--></div>
</div>

<div id="codeSnippetWrapper">Para facilitar el uso, lectura y parseo de las IPs desde la configuración, hemos incluido una clase llamada <em>IPRestriction</em> y una lista basada en ella:</div>

<div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; height: 293px; text-align: left; line-height: 12pt; overflow: auto; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);" id="codeSnippetWrapper">
  <div style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);" id="codeSnippet">
    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span style="color: rgb(0, 0, 255);">public</span> <span style="color: rgb(0, 0, 255);">class</span> IPRestrictionList : List&lt;IPRestriction&gt;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">{</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    <span style="color: rgb(0, 0, 255);">public</span> IPRestrictionList(<span style="color: rgb(0, 0, 255);">string</span> serviceConfigValue)</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    {</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        <span style="color: rgb(0, 0, 255);">string</span>[] ipEntries = serviceConfigValue.Split(<span style="color: rgb(0, 96, 128);">';'</span>);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        <span style="color: rgb(0, 0, 255);">if</span> (ipEntries.Count() &gt; 0)</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        {</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            <span style="color: rgb(0, 0, 255);">foreach</span> (<span style="color: rgb(0, 0, 255);">string</span> ipConfigValue <span style="color: rgb(0, 0, 255);">in</span> ipEntries)</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">            {</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">                <span style="color: rgb(0, 0, 255);">if</span> (!String.IsNullOrWhiteSpace(ipConfigValue))</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">                {</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">                    IPRestriction ip = <span style="color: rgb(0, 0, 255);">new</span> IPRestriction(ipConfigValue);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">                    <span style="color: rgb(0, 0, 255);">this</span>.Add(ip);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">                }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">            }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">}</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span style="color: rgb(0, 0, 255);">public</span> <span style="color: rgb(0, 0, 255);">class</span> IPRestriction</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">{</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    <span style="color: rgb(0, 0, 255);">public</span> IPRestriction(<span style="color: rgb(0, 0, 255);">string</span> configValue)</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    {</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        <span style="color: rgb(0, 0, 255);">string</span>[] data = configValue.Split(<span style="color: rgb(0, 96, 128);">','</span>);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        <span style="color: rgb(0, 0, 255);">if</span> (data.Count() != 3) </pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        {</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            <span style="color: rgb(0, 0, 255);">throw</span> <span style="color: rgb(0, 0, 255);">new</span> ArgumentException(<span style="color: rgb(0, 96, 128);">&quot;El valor {0} para crear una restricción de IP no es válido. Utilice el formato \&quot;&lt;Base IP&gt;,[Mascara Subred],&lt;true|false&gt;\&quot;. Para definir más de una restricción, sepárelas por \&quot;;\&quot;. Por ejemplo: 192.168.1.1,,false;124.16.20.0,255.255.255.0,true&quot;</span>, configValue);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        <span style="color: rgb(0, 0, 255);">this</span>.IP = IPAddress.Parse(data[0]);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        <span style="color: rgb(0, 0, 255);">this</span>.Mask = !String.IsNullOrEmpty(data[1].Trim()) ? IPAddress.Parse(data[1]) : <span style="color: rgb(0, 0, 255);">null</span>;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        <span style="color: rgb(0, 0, 255);">this</span>.Allowed = Boolean.Parse(data[2]);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    <span style="color: rgb(0, 0, 255);">public</span> IPAddress IP { get; set; }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    <span style="color: rgb(0, 0, 255);">public</span> IPAddress Mask { get; set; }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    <span style="color: rgb(0, 0, 255);">public</span> <span style="color: rgb(0, 0, 255);">bool</span> Allowed { get; set; }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    <span style="color: rgb(0, 0, 255);">public</span> <span style="color: rgb(0, 0, 255);">override</span> <span style="color: rgb(0, 0, 255);">string</span> ToString()</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    {</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        <span style="color: rgb(0, 0, 255);">return</span> <span style="color: rgb(0, 96, 128);">&quot;ipAddress=\&quot;&quot;</span> + <span style="color: rgb(0, 0, 255);">this</span>.IP.ToString() +</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">               <span style="color: rgb(0, 96, 128);">&quot;\&quot; &quot;</span> + (<span style="color: rgb(0, 0, 255);">this</span>.Mask != <span style="color: rgb(0, 0, 255);">null</span> ? <span style="color: rgb(0, 96, 128);">&quot;subnetMask=\&quot;&quot;</span> + <span style="color: rgb(0, 0, 255);">this</span>.Mask.ToString() + <span style="color: rgb(0, 96, 128);">&quot;\&quot; &quot;</span> : String.Empty) + </pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">               <span style="color: rgb(0, 96, 128);">&quot;allowed=\&quot;&quot;</span> + <span style="color: rgb(0, 0, 255);">this</span>.Allowed.ToString() + <span style="color: rgb(0, 96, 128);">&quot;\&quot;&quot;</span>;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    }</pre>
<!--CRLF--></div>
</div>

<p>Para finalizar, desde una clase que herede de <a href="https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.roleentrypoint.aspx" target="_blank">RoleEntryPoint</a> deberemos invocar nuestro método “EnableIPRestrictions” al iniciar el Role y cuando haya un cambio de configuración:</p>

<div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);" id="codeSnippetWrapper">
  <div style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);" id="codeSnippet">
    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span style="color: rgb(0, 0, 255);">public</span> <span style="color: rgb(0, 0, 255);">class</span> WebRole : RoleEntryPoint</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">{</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    <span style="color: rgb(0, 0, 255);">public</span> <span style="color: rgb(0, 0, 255);">override</span> <span style="color: rgb(0, 0, 255);">bool</span> OnStart()</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    {</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        RoleEnvironment.Changed +=<span style="color: rgb(0, 0, 255);">new</span> EventHandler&lt;RoleEnvironmentChangedEventArgs&gt;(RoleEnvironmentChangedEventHandler);</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        EnableIpRestrictions();</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        <span style="color: rgb(0, 0, 255);">return</span> <span style="color: rgb(0, 0, 255);">base</span>.OnStart();</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    <span style="color: rgb(0, 0, 255);">static</span> <span style="color: rgb(0, 0, 255);">private</span> <span style="color: rgb(0, 0, 255);">void</span> RoleEnvironmentChangedEventHandler(<span style="color: rgb(0, 0, 255);">object</span> sender, RoleEnvironmentChangedEventArgs e)</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    {</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        EnableIpRestrictions();</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    }</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">}</pre>
<!--CRLF--></div>
</div>

<p>Con esta aproximación podemos cambiar las direcciones desde las cuales nuestra aplicación es accesible sin necesidad de redesplegar un paquete.</p>]]></content:encoded>
    </item>
    <item>
      <title>Índices grandes en SQL Azure, error 40552</title>
      <link>https://docs.microsoft.com/archive/blogs/ralarcon/ndices-grandes-en-sql-azure-error-40552</link>
      <pubDate>Wed, 07 Mar 2012 14:50:47 GMT</pubDate>
      <dc:creator><![CDATA[Raúl Alarcón]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ralarcon/2012/03/07/ndices-grandes-en-sql-azure-error-40552/</guid>
      <description><![CDATA[El otro día, en el proyecto donde estoy trabajando ahora, me encontré con la siguiente situación: en...]]></description>
      <content:encoded><![CDATA[<p>El otro día, en el proyecto donde estoy trabajando ahora, me encontré con la siguiente situación: en una base de datos SQL Azure, sobre una tabla que tenía más de 10 millones de registros, necesito crear un índice para optimizar una serie de consultas. La tabla, contiene cerca de 100 campos y en el índice quiero incluir un número importante de ellos (unos 25).</p>  <p>El resultado inicial, después de 15 minutos, es el siguiente:</p>  <p><font color="#ff0000"><em>Msg 40552, Level 20, State 1, Line 1</em>      <br /><em>The session has been terminated because of excessive transaction log space usage. Try modifying fewer rows in a single transaction.</em>      <br /><em>Msg 0, Level 20, State 0, Line 0</em>      <br /><em>A severe error occurred on the current command. The results, if any, should be discarded.</em></font></p>  <p>El problema lo entiendo perfectamente: estoy consumiendo mucho log de transacciones por que la tabla tiene muchas filas y estoy creando un índice bastante grande, pero… ¿¡QUE HAGO!?, yo necesito ese índice. Estos errores se enmarcan dentro de los errores de transitorios SQL Azure (en concreto de pérdida de conexión).</p>  <p>Bien, dando una vuelta por la <a href="https://msdn.microsoft.com/en-us/library/windowsazure/ff394106.aspx" target="_blank">documentación de los errores</a> (muy buena por cierto) veo que menciona que a la hora de reconstruir un índice puedes utilizar la opción “WITH (ONLINE=ON)”. Pues no sólo vale para “reconstruir”, también vale para crear nuevos índices o borrar existentes.</p>  <p>Ale, problema resuelto.</p>]]></content:encoded>
    </item>
    <item>
      <title>Configuración Avanzada (y flexible) en Windows Azure</title>
      <link>https://docs.microsoft.com/archive/blogs/ralarcon/configuracin-avanzada-y-flexible-en-windows-azure</link>
      <pubDate>Wed, 29 Feb 2012 14:58:00 GMT</pubDate>
      <dc:creator><![CDATA[Raúl Alarcón]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ralarcon/2012/02/29/configuracin-avanzada-y-flexible-en-windows-azure/</guid>
      <description><![CDATA[Entre @ridomin y yo hemos escrito un art&iacute;culo sobre la configuraci&oacute;n de aplicaciones...]]></description>
      <content:encoded><![CDATA[<p>Entre @ridomin y yo hemos escrito un art&iacute;culo sobre la configuraci&oacute;n de aplicaciones en Windows Azure considerando todo el ciclo de vida de las aplicaciones y los requisitos que un proceso de construcci&oacute;n de software formal tiene.</p>
<p>Pod&eacute;is leer la versi&oacute;n en castellano <a title="Configuraci&oacute;n Avanzada en Windows Azure" href="https://blogs.msdn.com/b/ralarcon/p/configuracion-avanzada-windows-azure.aspx">aqu&iacute; en mi blog</a>&nbsp;y la versi&oacute;n en ingl&eacute;s en el <a href="https://blogs.msdn.com/b/rido/p/advanced_configuration_azure_applications.aspx">blog de Rido</a>.</p>
<p>Este art&iacute;culo es el primero de una serie en la que esperamos ir construyendo una herramienta para gestionar de forma avanzada, y desde un punto de vista novedoso, la configuraci&oacute;n de las aplicaciones que se ejecutan en Azure.&nbsp;Hemos escrito el articulo de los conceptos m&aacute;s globales a los m&aacute;s concretos, planteando un concepto de soluci&oacute;n de la cual ya tenemos una PoC.</p>
<p>Espero que os guste.</p>]]></content:encoded>
    </item>
    <item>
      <title>Windows Azure y Classic Pipeline (Segunda Parte)</title>
      <link>https://docs.microsoft.com/archive/blogs/ralarcon/windows-azure-y-classic-pipeline-segunda-parte</link>
      <pubDate>Mon, 19 Dec 2011 14:27:15 GMT</pubDate>
      <dc:creator><![CDATA[Raúl Alarcón]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ralarcon/2011/12/19/windows-azure-y-classic-pipeline-segunda-parte/</guid>
      <description><![CDATA[En la primera parte, vimos los requisitos que teníamos que cumplir para poder ejecutar una...]]></description>
      <content:encoded><![CDATA[<p>En la <a href="https://blogs.msdn.com/b/ralarcon/archive/2011/11/16/windows-azure-y-classic-pipeline.aspx" target="_blank">primera parte</a>, vimos los requisitos que teníamos que cumplir para poder ejecutar una aplicación web diseñada para IIS 6.0 en un IIS 7.0 ó 7.5, y por ende, para poderla ejecutar en Windows Azure. El principal requisito es que la aplicación pueda utilizar el Modo Clásico del pipeline de .NET.</p>  <p>El único inconveniente de la solución aportada en la <a href="https://blogs.msdn.com/b/ralarcon/archive/2011/11/16/windows-azure-y-classic-pipeline.aspx" target="_blank">primera parte</a> es que sólo es apta para aplicación que utilicen la versión de .NET 2.0/3.5.</p>  <p>Al ejecutar una aplicación en .NET 4.0 y que además utilice el pipeline clásico, nos encontraremos con un error 404 (File or directory not found), que la verdad, nos puede dejar un poco descolocados:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/88/84/metablogapi/6354.image_4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-88-84-metablogapi/6354.image_5F00_4.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/88/84/metablogapi/1586.image_thumb_1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-88-84-metablogapi/1586.image_5F00_thumb_5F00_1.png" width="644" height="333" /></a></p>  <p>Como casi no nos lo podemos creer, nos vamos al servidor y vemos que el error tiene un pequeño matiz, el error es un 404.2:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/88/84/metablogapi/7840.image_5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-88-84-metablogapi/7840.image_5F00_5.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/88/84/metablogapi/1067.image_thumb.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-88-84-metablogapi/1067.image_5F00_thumb.png" width="644" height="462" /></a></p>  <p>Vemos que el problema está relacionado con el ISAPI que maneja las peticiones ASPX. <a href="https://support.microsoft.com/kb/942040/en-us" target="_blank">Buscando literatura</a> vemos que la raíz del problema es que, por defecto, el filtro ISAPI para .NET 4.0 no está activado por defecto. Podemos verlo en la siguiente imagen:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/88/84/metablogapi/8420.image_10.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-88-84-metablogapi/8420.image_5F00_10.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/88/84/metablogapi/3124.image_thumb_4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-88-84-metablogapi/3124.image_5F00_thumb_5F00_4.png" width="644" height="286" /></a></p>  <p>Bueno, una vez diagnosticado el problema sólo tenemos que buscar la manera de poder habilitar el filtro ISAPI para .NET 4.0 de manera automática (cómo ya explicamos en la <a href="https://blogs.msdn.com/b/ralarcon/archive/2011/11/16/windows-azure-y-classic-pipeline.aspx" target="_blank">primera parte</a>, al tratarse de Azure no podemos realizar las configuraciones manualmente). </p>  <p>Buscando buscando, <a href="https://www.iis.net/ConfigReference/system.webServer/isapiFilters" target="_blank">encontré</a> la manera de modificar la sección de configuración de IIS que gestiona los filtros ISAPI (<font face="Courier New">&lt;isapiFilters&gt;</font>) y preparé un nuevo método dentro de nuestra clase <a href="https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.roleentrypoint.aspx" target="_blank">RoleEntryPoint</a> para establecer la configuración necesaria, el método <em>AllowAspNet4Isapi</em>:</p>  <div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);" id="codeSnippetWrapper">   <div style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);" id="codeSnippet">     <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span style="color: rgb(0, 0, 255);">Private</span> <span style="color: rgb(0, 0, 255);">Sub</span> AllowAspNet4Isapi()</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    Trace.WriteLine(<span style="color: rgb(0, 96, 128);">&quot;AllowAspNet4ISAPI...&quot;</span>)</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    <span style="color: rgb(0, 0, 255);">Dim</span> serverManager <span style="color: rgb(0, 0, 255);">As</span> ServerManager = <span style="color: rgb(0, 0, 255);">New</span> ServerManager</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    <span style="color: rgb(0, 0, 255);">Try</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        <span style="color: rgb(0, 0, 255);">Dim</span> config <span style="color: rgb(0, 0, 255);">As</span> Configuration = ServerManager.GetApplicationHostConfiguration</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        <span style="color: rgb(0, 0, 255);">Dim</span> isapiCgiRestrictionSection <span style="color: rgb(0, 0, 255);">As</span> ConfigurationSection = config.GetSection(<span style="color: rgb(0, 96, 128);">&quot;system.webServer/security/isapiCgiRestriction&quot;</span>)</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        <span style="color: rgb(0, 0, 255);">Dim</span> isapiCgiRestrictionCollection <span style="color: rgb(0, 0, 255);">As</span> ConfigurationElementCollection = isapiCgiRestrictionSection.GetCollection</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        <span style="color: rgb(0, 0, 255);">Dim</span> elems = isapiCgiRestrictionCollection.Where(<span style="color: rgb(0, 0, 255);">Function</span>(ce) ce.Attributes(<span style="color: rgb(0, 96, 128);">&quot;description&quot;</span>).Value = <span style="color: rgb(0, 96, 128);">&quot;ASP.NET v4.0.30319&quot;</span>)</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        <span style="color: rgb(0, 0, 255);">For</span> <span style="color: rgb(0, 0, 255);">Each</span> e <span style="color: rgb(0, 0, 255);">As</span> ConfigurationElement <span style="color: rgb(0, 0, 255);">In</span> elems</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">            Trace.WriteLine(<span style="color: rgb(0, 96, 128);">&quot;Accessing to set 'allowed'=true...&quot;</span>)</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            e.Attributes(<span style="color: rgb(0, 96, 128);">&quot;allowed&quot;</span>).Value = <span style="color: rgb(0, 0, 255);">True</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        <span style="color: rgb(0, 0, 255);">Next</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        serverManager.CommitChanges()</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    <span style="color: rgb(0, 0, 255);">Catch</span> ex <span style="color: rgb(0, 0, 255);">As</span> Exception</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        Trace.WriteLine(<span style="color: rgb(0, 96, 128);">&quot;Se ha producido un error: &quot;</span> + ex.Message)</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        Trace.WriteLine(<span style="color: rgb(0, 96, 128);">&quot;Exception: &quot;</span> + ex.ToString())</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    <span style="color: rgb(0, 0, 255);">Finally</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        serverManager.Dispose()</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    <span style="color: rgb(0, 0, 255);">End</span> <span style="color: rgb(0, 0, 255);">Try</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"><span style="color: rgb(0, 0, 255);">End</span> <span style="color: rgb(0, 0, 255);">Sub</span></pre>
<!--CRLF--></div>
</div>

<p>Con este nuevo método y un pequeño refactoring, OnStart() queda como sigue:</p>

<div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);" id="codeSnippetWrapper">
  <div style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);" id="codeSnippet">
    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span style="color: rgb(0, 0, 255);">Public</span> <span style="color: rgb(0, 0, 255);">Overrides</span> <span style="color: rgb(0, 0, 255);">Function</span> OnStart() <span style="color: rgb(0, 0, 255);">As</span> <span style="color: rgb(0, 0, 255);">Boolean</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    <span style="color: rgb(0, 128, 0);">'Configure Azure Tracing</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    ConfigureTracing()</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    <span style="color: rgb(0, 128, 0);">'Permitir el ISAPI de .NET 4.0</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    AllowAspNet4Isapi()</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    <span style="color: rgb(0, 128, 0);">'Configure Azure Pipeline</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    SetClassicIISPipelineMode()</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    <span style="color: rgb(0, 0, 255);">Return</span> <span style="color: rgb(0, 0, 255);">MyBase</span>.OnStart()</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span style="color: rgb(0, 0, 255);">End</span> <span style="color: rgb(0, 0, 255);">Function</span></pre>
<!--CRLF--></div>
</div>

<p>Espero que os sea de utilidad, aunque repitiendo lo ya dicho en la <a href="https://blogs.msdn.com/b/ralarcon/archive/2011/11/16/windows-azure-y-classic-pipeline.aspx" target="_blank">primera parte</a>, mi recomendación personal es actualizar la aplicación para poder ejecutarla utilizando el modo integrado, que tiene bastantes ventajas sobre el clásico (<a href="https://stackoverflow.com/questions/716049/what-is-the-difference-between-classic-and-integrated-in-iis7" target="_blank">ref1</a>, <a href="https://msdn.microsoft.com/es-ES/library/bb515251(v=vs.90).aspx" target="_blank">ref2</a>).</p>]]></content:encoded>
    </item>
    <item>
      <title>Windows Azure y Classic Pipeline</title>
      <link>https://docs.microsoft.com/archive/blogs/ralarcon/windows-azure-y-classic-pipeline</link>
      <pubDate>Wed, 16 Nov 2011 14:32:39 GMT</pubDate>
      <dc:creator><![CDATA[Raúl Alarcón]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/ralarcon/2011/11/16/windows-azure-y-classic-pipeline/</guid>
      <description><![CDATA[Por defecto, Windows Azure únicamente puede ejecutar aplicaciones web sobre IIS7.5, o por decirlo de...]]></description>
      <content:encoded><![CDATA[<p>Por defecto, Windows Azure únicamente puede ejecutar aplicaciones web sobre IIS7.5, o por decirlo de otra manera, aplicaciones que utilizan el pipeline de IIS en modo integrado. </p>  <p>Aunque mi recomendación personal es actualizar la aplicación para poder ejecutarla utilizando el modo integrado, este post propone una alternativa para poder ejecutar una aplicación que necesite el pipeline en modo clásico, aunque sea como solución a corto plazo. Una buena referencia sobre como migrar aplicaciones de IIS 6.0 a IIS 7.0 está <a href="https://www.google.es/url?sa=t&amp;rct=j&amp;q=iis%207.5%20%20pipeline%20integrated%20mode%20site%3Amicrosoft.com&amp;source=web&amp;cd=4&amp;sqi=2&amp;ved=0CCsQFjAD&amp;url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fbb515251.aspx&amp;ei=2-DCTp_WO8nQ8gPUi93mCg&amp;usg=AFQjCNFgqLkxA9PRYvCv1cFKKhuuWhLtaA" target="_blank">disponible aquí</a>.</p>  <p>Para poder ejecutar una aplicación web diseñada para IIS 6.0 en un IIS 7.0 ó 7.5 simplemente tenemos que asegurarnos de que el <em>Application Pool</em> que utiliza esté configurado con un pipeline en modo clásico. Un equipo con Windows 7 o Windows 2008 R2 y con el .NET Framework 4.0 instalado tendrá los siguientes <em>application pools</em> por defecto:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/88/84/metablogapi/4478.image_2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-88-84-metablogapi/4478.image_5F00_2.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/88/84/metablogapi/1258.image_thumb.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-88-84-metablogapi/1258.image_5F00_thumb.png" width="548" height="196" /></a></p>  <p>El error “<a href="https://social.technet.microsoft.com/wiki/contents/articles/2944.aspx" target="_blank">Request is not available in this context</a>” es uno de los más comunes que se reciben si una aplicación web desarrollada para utilizar el pipeline en modo clásico se ejecuta en modo integrado:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/88/84/metablogapi/1273.image_8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-88-84-metablogapi/1273.image_5F00_8.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/88/84/metablogapi/0272.image_thumb_3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-88-84-metablogapi/0272.image_5F00_thumb_5F00_3.png" width="482" height="239" /></a></p>  <p>Como hemos dicho, para que una aplicación web pueda ejecutarse con un pipeline en modo clásico sólo tenemos que modificar su <em>application pool</em>:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/88/84/metablogapi/3240.image_6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-88-84-metablogapi/3240.image_5F00_6.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/88/84/metablogapi/8535.image_thumb_2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-88-84-metablogapi/8535.image_5F00_thumb_5F00_2.png" width="326" height="260" /></a></p>  <p>Bien, el problema que se nos presenta en <strong>Windows Azure</strong> es que, si queremos que nuestro cambio sea persistente y coherente con el modelo de Azure,&#160; no podemos modificar la configuración manualmente ya que en el caso de que nuestro servidor(es) se regenerara, perderíamos dicha configuración.</p>  <p>La única alternativa que tenemos es utilizar la infraestructura software de Windows Azure, concretamente la clase <a href="https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.roleentrypoint.aspx" target="_blank">RoleEntryPoint</a>. Para ello, añadimos una clase en nuestra aplicación web que herede de <a href="https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.roleentrypoint.aspx" target="_blank">RoleEntryPoint</a>, después sobre-escribiremos el método “OnStart()” con el siguiente código (esta vez Visual Basic .NET):</p>  <div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);" id="codeSnippetWrapper">   <div style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);" id="codeSnippet">     <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span style="color: rgb(0, 0, 255);">Public</span> <span style="color: rgb(0, 0, 255);">Overrides</span> <span style="color: rgb(0, 0, 255);">Function</span> OnStart() <span style="color: rgb(0, 0, 255);">As</span> <span style="color: rgb(0, 0, 255);">Boolean</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    <span style="color: rgb(0, 0, 255);">Dim</span> srvManager <span style="color: rgb(0, 0, 255);">As</span> <span style="color: rgb(0, 0, 255);">New</span> ServerManager()</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">    <span style="color: rgb(0, 0, 255);">Try</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        <span style="color: rgb(0, 0, 255);">Dim</span> appSite = (From site <span style="color: rgb(0, 0, 255);">In</span> srvManager.Sites</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">                      Where site.Name.Contains(RoleEnvironment.CurrentRoleInstance.Role.Name)).FirstOrDefault()</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        <span style="color: rgb(0, 0, 255);">If</span> <span style="color: rgb(0, 0, 255);">Not</span> appSite <span style="color: rgb(0, 0, 255);">Is</span> <span style="color: rgb(0, 0, 255);">Nothing</span> <span style="color: rgb(0, 0, 255);">Then</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            <span style="color: rgb(0, 0, 255);">Dim</span> appPool = (From pool <span style="color: rgb(0, 0, 255);">In</span> srvManager.ApplicationPools</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">                      Where pool.Name = appSite.Applications(0).ApplicationPoolName).FirstOrDefault()</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            <span style="color: rgb(0, 0, 255);">If</span> (<span style="color: rgb(0, 0, 255);">Not</span> appPool <span style="color: rgb(0, 0, 255);">Is</span> <span style="color: rgb(0, 0, 255);">Nothing</span>) <span style="color: rgb(0, 0, 255);">Then</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">                appPool.ManagedPipelineMode = ManagedPipelineMode.Classic</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">                srvManager.CommitChanges()</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            <span style="color: rgb(0, 0, 255);">End</span> <span style="color: rgb(0, 0, 255);">If</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        <span style="color: rgb(0, 0, 255);">Else</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">            Trace.WriteLine(<span style="color: rgb(0, 96, 128);">&quot;Unable to get AppSite reference&quot;</span>)</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">        <span style="color: rgb(0, 0, 255);">End</span> <span style="color: rgb(0, 0, 255);">If</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    <span style="color: rgb(0, 0, 255);">Catch</span> ex <span style="color: rgb(0, 0, 255);">As</span> Exception</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        Trace.WriteLine(<span style="color: rgb(0, 96, 128);">&quot;Exception: &quot;</span> + ex.ToString())</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    <span style="color: rgb(0, 0, 255);">Finally</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">        srvManager.Dispose()</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">    <span style="color: rgb(0, 0, 255);">End</span> <span style="color: rgb(0, 0, 255);">Try</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"><span style="color: rgb(0, 0, 255);">End</span> <span style="color: rgb(0, 0, 255);">Sub</span></pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;">&#160;</pre>
<!--CRLF-->

    <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">  </pre>
<!--CRLF--></div>
</div>

<p>Este código depende de la librería <a href="https://msdn.microsoft.com/en-us/library/microsoft.web.administration(v=VS.90).aspx" target="_blank">Microsoft.Web.Administration</a> por lo que tendrás que añadir la referencia en el proyecto.</p>

<p>La siguiente vez que ejecutemos la aplicación en un contexto Azure (tanto en el emulador como en un entorno Windows Azure real), el pipeline se configurará automáticamente para utilizar el modo clásico. Si el Web Role se regenera, no hay problema, el método “OnStart()” será invocado de nuevo.</p>

<p>Por último decir que <strong>este método sólo es válido si la aplicación utiliza .NET Framework 2.0/3.5</strong>. Para poder ejecutar una aplicación <em>.NET Framework 4.0 en modo clásico </em>hay que pasar por algún que otro inconveniente más y añadir más configuración (lo sé, no es algo que tenga mucho sentido, lo mejor sería actualizarla, pero hay de todo en la viña del Señor)… pero eso lo veremos en el siguiente post! </p>]]></content:encoded>
    </item>
  </channel>
</rss>