<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Prashant Upadhyay</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/prashant_upadhyay/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/prashant_upadhyay/feed.xml</link>
    <description />
    <lastBuildDate>Tue, 16 Apr 2019 06:21:07 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Upgrading target framework from 4.0 to 4.5 for ASP.NET MVC applications</title>
      <link>https://docs.microsoft.com/archive/blogs/prashant_upadhyay/upgrading-target-framework-from-4-0-to-4-5-for-asp-net-mvc-applications</link>
      <pubDate>Thu, 18 Oct 2012 23:32:00 GMT</pubDate>
      <dc:creator><![CDATA[PrashantUpadhyay]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/prashant_upadhyay/2012/10/18/upgrading-target-framework-from-4-0-to-4-5-for-asp-net-mvc-applications/</guid>
      <description><![CDATA[Recently, I finished upgrading my ASP.NET MVC 4 application(in Visual Studio 2012) from .NET 4.0...]]></description>
      <content:encoded><![CDATA[<p></p>
<p style="text-align: justify;">Recently, I finished upgrading my ASP.NET MVC 4 application(in Visual Studio 2012) from .NET 4.0 to .NET 4.5 framework. Not-so-easy job though. A lot of pain and anxiety is involved when you migrate to a different target framework version and when you know that you have a lot of Nuget package references and use a couple of third-party components that interface with a specific version of .NET framework. So, i thought of sharing my experiences and challenges during this process.</p>
<p style="text-align: justify;">The easiest way to target all projects to .NET 4.5 framework is by doing a search for all *.csproj files and replace&nbsp;<em>&lt;TargetFrameworkVersion&gt;v4.0&lt;/TargetFrameworkVersion&gt; &nbsp;</em>with<em>&nbsp;&lt;TargetFrameworkVersion&gt;v4.5&lt;/TargetFrameworkVersion&gt;&nbsp;</em>(or client profile, etc). You would also need to&nbsp;replace the &lt;<em>compilation&gt;</em>&nbsp;element's&nbsp;<em>targetFramework=&rdquo;4.0&Prime;</em>&nbsp;with 4.5 in the application's web.config file.</p>
<p>Issues after migrating ASP.NET MVC solution from .NET 4.0 to .NET 4.5:</p>
<p>=========================================================================================================</p>
<ol>
<li>The real issue are the NuGet packages, they will just not work, &ndash; some have a .NET 4.5 specific version &ndash; a good example is Entity Framework. When the project is targeting version 4.0 of the framework and you install/update EF to version 5 you actually end up with EF 4.4 (which&nbsp;doesn't&nbsp;have support for enum types and so on, targeted for .NET 4.5). When i looked at my project reference, I found the following entry:</li>
</ol>
<p><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="tag">&lt;Reference</span><span class="pln"> </span><span class="atn">Include</span><span class="pun">=</span><span class="atv">"EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"</span><span class="tag">&gt;</span><br /><span class="tag"><span class="Apple-tab-span" style="white-space: pre;"> </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;SpecificVersion&gt;</span><span class="pln">False</span><span class="tag">&lt;/SpecificVersion&gt;</span><br /><span class="tag"><span class="Apple-tab-span" style="white-space: pre;"> </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;HintPath&gt;</span><span class="pln">..\packages\EntityFramework.5.0.0\lib\net40\EntityFramework.dll</span><span class="tag">&lt;/HintPath&gt;</span><br /><span class="Apple-tab-span" style="white-space: pre;"> </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&lt;/Reference&gt;</p>
<p style="text-align: justify;">&nbsp; <span class="Apple-tab-span" style="white-space: pre;"> </span>&nbsp; &nbsp; &nbsp;The only way to solve this is to remove all packages and install them again, which is a massive pain to do manually and unfortunately the current version of NuGet is not of much help there either.</p>
<p style="text-align: justify;">&nbsp;<span class="Apple-tab-span" style="white-space: pre;"> </span>&nbsp; &nbsp; &nbsp;Open Visual Studio 2012,</p>
<p style="text-align: justify;"><span class="Apple-tab-span" style="white-space: pre;"> </span>&nbsp; &nbsp; &nbsp;Go to &ldquo;Tools&rdquo; &gt; &ldquo;Library Package Manager&rdquo; &gt; &ldquo;Package Manager Console&rdquo;. This will open a powershell command prompt,</p>
<p style="text-align: justify;"><span class="Apple-tab-span" style="white-space: pre;"> </span>&nbsp; &nbsp; &nbsp;then type: <i>uninstall-package EntityFramework</i> for each of the listed projects for the default project dropdown.</p>
<p style="text-align: justify;">&nbsp;<span class="Apple-tab-span" style="white-space: pre;"> </span>&nbsp; &nbsp; &nbsp;After uninstalling EntityFramework from each of the projects, install EntityFramework by typing &ldquo;<i>install-package EntityFramework</i>&rdquo; in the powershell command-prompt.</p>
<p style="text-align: justify;">&nbsp;<span class="Apple-tab-span" style="white-space: pre;"> </span>&nbsp; &nbsp; &nbsp;NuGet 2.0 doesn't handle re-targeting your applications very well. In order to change your packages' target frameworks, you must uninstall and reinstall the packages.</p>
<p>&nbsp;<span class="Apple-tab-span" style="white-space: pre;"> </span>&nbsp; &nbsp;&nbsp;The reasons why packages must be uninstalled and&nbsp;re-installed&nbsp;are:</p>
<ul>
<ul>
<li>When installing a package, we determine the target framework of your project</li>
<li>We then match that up with the package contents, finding the appropriate \lib\ folder (and \content\ folder)</li>
<li>Assembly references are added with Hint Paths that point to the package's \lib\ folder, with the right subfolder (\lib\net40 for example)</li>
<li>Content files are copied from the packages \content\ folder, with the right subfolder (\content\net40 for example)</li>
<li>We record the targetFramework used to install the package within the packages.config file</li>
<li>After you change your project's target framework, the Hint Paths still point to net40</li>
<li>When you uninstall packages, we check the targetFramework that was recorded in packages.config to see what target framework's libs/content to remove from your project</li>
<li>When you reinstall the package, we detect your updated target framework and reference/copy the right libs/content</li>
</ul>
</ul>
<p><span class="Apple-tab-span" style="white-space: pre;"> </span>2.<span class="Apple-tab-span" style="white-space: pre;"> </span>ELMAH and Ninject work like a charm without any changes. That's a good news.&nbsp;</p>
<p><span class="Apple-tab-span" style="white-space: pre;"> </span>3.<span class="Apple-tab-span" style="white-space: pre;"> </span>Make sure you take a look into&nbsp;<a href="http://ivanz.com/2012/08/17/heads-up-on-a-hidden-breaking-change-in-asp-net-mvc-4/" title="Heads up on a hidden breaking change in ASP.NET MVC 4">this one about the new Date and DateTime editor templates in MVC 4</a>. Also there seem to be model binding changes to do with&nbsp;<i>DateTime</i>&nbsp;.&nbsp;<span class="Apple-tab-span" style="white-space: pre;"> </span></p>
<p><span class="Apple-tab-span" style="white-space: pre;"> </span>4.<span class="Apple-tab-span" style="white-space: pre;"> </span>Lastly, don&rsquo;t forget to update your test assemblies&nbsp;<i>App.config</i>&nbsp;with the correct assembly redirects if you are running tests against ASP.NET MVC controllers, which use MvcFutures or MvcContrib, because you will end up<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>seeing weird &ldquo;Type A doesn&rsquo;t match type A&rdquo; errors.</p>]]></content:encoded>
    </item>
    <item>
      <title>Unable to expand server node in the IIS 7 UI with shared configuration</title>
      <link>https://docs.microsoft.com/archive/blogs/prashant_upadhyay/unable-to-expand-server-node-in-the-iis-7-ui-with-shared-configuration</link>
      <pubDate>Tue, 20 Sep 2011 12:12:36 GMT</pubDate>
      <dc:creator><![CDATA[PrashantUpadhyay]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/prashant_upadhyay/2011/09/20/unable-to-expand-server-node-in-the-iis-7-ui-with-shared-configuration/</guid>
      <description><![CDATA[This article talks about one of issues that occur when you use shared configuration on IIS 7. The...]]></description>
      <content:encoded><![CDATA[<p><span style="font-size: small;">This article talks about one of issues that occur when you use shared configuration on IIS 7. The scenario results when you have made changes in IIS 7 with respect to shared configuration mentioned in the below article: </span><span style="font-size: small;"><a href="http://learn.iis.net/page.aspx/264/shared-configuration/">http://learn.iis.net/page.aspx/264/shared-configuration/</a>&nbsp;and during the course of time, the user information(the password information) has been changed on the web server for the user account that has been used in the above-said configuration.</span>&nbsp;</p>
<p><span style="font-size: small;"><strong>Symptoms</strong>:</span></p>
<p><span style="font-size: small;">===============================================================================================</span></p>
<p><span style="font-size: small;">Unable to start FTP, WWW, WAS services. Unable to expand server node in the IIS manager.</span></p>
<p><span style="font-size: small;">-------------------------</span></p>
<p><span style="font-size: small;">Failed to connect</span></p>
<p><span style="font-size: small;">-------------------------</span></p>
<p><span style="font-size: small;">There was an error when trying to connect. Do you want to retype your credentials and try again?</span></p>
<p><span style="font-size: small;">Details: Filename:\\?\C:\Windows\Microsoft.Net\Framework64\v2.0.50727\CONFIG\machine.config</span></p>
<p><span style="font-size: small;">Error:</span></p>
<p><span style="font-size: small;"><strong>Cause</strong>:</span></p>
<p><span style="font-size: small;">===============================================================================================</span></p>
<p>Ran 'appcmd list sites' command from an elevated prompt.</p>
<p>ERROR ( message: Configuration error</p>
<p>Filename: <a href="file://\\?\C:\Windows\system32\inetsrv\config\redirection.config">\\?\C:\Windows\system32\inetsrv\config\redirection.config</a></p>
<p>Line Number: 13</p>
<p>Description: Cannot log on locally to <a href="file://\\somesharedpath\\sharedfolder">\\somesharedpath\\sharedfolder</a> &nbsp;as user&nbsp;DOMAIN\Username with redirection.config password</p>
<p>. )</p>
<p>This error occurs when&nbsp;the password stored for the shared configuration is not correct.</p>
<p><span style="font-size: small;"><strong>Resolution</strong>:</span></p>
<p><span style="font-size: small;">================================</span></p>
<p>Opened the file <strong>redirection.config</strong> from C:\windows\system32\inetsrv\config</p>
<p>You will see a node like:</p>
<p>&lt;configurationRedirection enabled=&rdquo;true&rdquo; path=&rdquo;&lt;path to shared config&gt;&rdquo; userName=&rdquo;username&Prime; password=&rdquo;[enc:IISRsaProvider:57686f6120447564652c2049495320526f636b73:enc]&rdquo; /&gt;</p>
<p>This node enables the shared configuration with the credentials to use.</p>
<p>Now, you have two choices,</p>
<p><span style="text-decoration: underline;"><strong>Choice 1</strong></span>: You do not have a requirement to use shared configuration. To disable sharedconfiguration,change the node from:</p>
<p>&lt;configurationRedirection enabled=&rdquo;true&rdquo; path=&rdquo;&lt;path to shared config&gt;&rdquo; userName=&rdquo;username&Prime; password=&rdquo;[enc:IISRsaProvider:57686f6120447564652c2049495320526f636b73:enc]&rdquo; /&gt;</p>
<p>to</p>
<p>&lt;configurationRedirection/&gt;</p>
<p>After making the change, the configuration will look like</p>
<p>&nbsp;<br />&lt;configuration&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;configSections&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;section name=&rdquo;configurationRedirection&rdquo; /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/configSections&gt;</p>
<p>&lt;configProtectedData&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;providers&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;add name=&rdquo;IISRsaProvider&rdquo; type=&rdquo;" description=&rdquo;Uses RsaCryptoServiceProvider to encrypt and decrypt&rdquo; keyContainerName=&rdquo;iisConfigurationKey&rdquo; cspProviderName=&rdquo;" useMachineContainer=&rdquo;true&rdquo;&nbsp; useOAEP=&rdquo;false&rdquo; /&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/providers&gt;<br />&lt;/configProtectedData&gt;</p>
<p>&lt;configurationRedirection /&gt;</p>
<p>&lt;/configuration&gt;</p>
<p>Restart IIS.</p>
<p><span style="text-decoration: underline;"><strong>Choice 2</strong></span>: You require shared configuration on your web server. In this case, the easiest way to resolve it is to follow the choice 1(above) and setup the shared configuration from the article:</p>
<p><a href="http://learn.iis.net/page.aspx/264/shared-configuration/">http://learn.iis.net/page.aspx/264/shared-configuration/</a> using the the user account with the correct set of username and passowrd information.</p>
<p><span style="font-size: small;">Restart IIS.</span></p>
<p><span style="font-size: small;"></span></p>]]></content:encoded>
    </item>
    <item>
      <title>Why debug=false in ASP.NET applications in production environment</title>
      <link>https://docs.microsoft.com/archive/blogs/prashant_upadhyay/why-debugfalse-in-asp-net-applications-in-production-environment</link>
      <pubDate>Thu, 14 Jul 2011 16:23:00 GMT</pubDate>
      <dc:creator><![CDATA[PrashantUpadhyay]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/prashant_upadhyay/2011/07/14/why-debugfalse-in-asp-net-applications-in-production-environment/</guid>
      <description><![CDATA[Have you ever wondered what harm does the flag Debug=True brings to your application?
Besides...]]></description>
      <content:encoded><![CDATA[<p>Have you ever wondered what harm does the flag <strong>Debug=True</strong> brings to your application?</p>
<p>Besides hurting your application's performance in production house, it turns website lifecycle into a vicious circle.</p>
<p>Here is my understanding of using &lt;compilation debug="true" /&gt; on your application's web.config file:</p>
<p>When &lt;compilation debug=&rdquo;true&rdquo; /&gt; is switched on within the application&rsquo;s web.config file, it causes a number of non-optimal things to happen including:</p>
<p>1) You will see a lot more files in Temporary ASP.NET files folder when you use debug=true.</p>
<p>2) Your pages will not timeout when you have debug=&ldquo;true&rdquo; which is no an ideal production scenario.</p>
<p>3) Batch compilation will be disabled even if the batch attribute is true in the &lt;compilation&gt; element.</p>
<p>4) The System.Diagnostics.DebuggableAttribute gets added to all generated code which causes performance degradation. Basically, when you have debug=true, the DebuggableAttribute gets added to all generated code.</p>
<p>5) All client-javascript libraries and static images that are deployed via WebResources.axd will be continually downloaded by clients on each page view request and not cached locally within the browser.&nbsp; This can slow down the user experience quite a bit for things like Atlas, controls like TreeView/Menu/Validators, and any other third-party control or custom code that deploys client resources.&nbsp; Note that the reason why these resources are not cached when debug is set to true is so that developers don&rsquo;t have to continually flush their browser cache and restart it every-time they make a change to a resource handler (our assumption is that when you have debug=true set you are in active development on your site).</p>
<p>6) When &lt;compilation debug=&rdquo;false&rdquo;/&gt; is set, the WebResource.axd handler will automatically set a long cache policy on resources retrieved via it &ndash; so that the resource is only downloaded once to the client and cached there forever (it will also be cached on any intermediate proxy servers).&nbsp; If you have Atlas installed for your application, it will also automatically compress the content from the WebResources.axd handler for you when &lt;compilation debug=&rdquo;false&rdquo;/&gt; is set &ndash; reducing the size of any client-script javascript library or static resource for you (and not requiring you to write any custom code or configure anything within IIS to get it).</p>
<p>7) When the debug attribute in the Web.config file is set to true, it generates symbolic information(.pdb information) every time the compiler compiles your .aspx pages as well as disables code optimization. If the application is not being debugged, you should change this attribute to false.</p>
<p>While the debugger is attached and in break mode, no requests to pages in the application execute. Therefore, you should not debug an application on a production Web server while it is in use.</p>
<p>Only one debugger can be attached to the Aspnet_wp.exe process at a time.</p>
<p>The CLR Debugger only debugs managed code, and it only debugs applications on the computer on which the CLR Debugger is running. If you need to debug remotely or if you need to debug code other than managed code, you should use the Visual Studio .NET debugger.</p>
<p>Please refer:http://support.microsoft.com/kb/301058</p>
<p>Now, let's see how can you turn OFF this flag at the server level ?</p>
<p>As obvious as this, please use the following configuration feature on the machine.config file:</p>
<p>&lt;configuration&gt;<br />&nbsp;&nbsp;&nbsp; &lt;system.web&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;deployment retail=&rdquo;true&rdquo;/&gt;<br />&nbsp;&nbsp;&nbsp; &lt;/system.web&gt;<br />&lt;/configuration&gt;<br />&nbsp;<br />You will disable the &lt;compilation debug=&rdquo;true&rdquo;/&gt; switch and this will disable the ability to trace output in a page, and turn off the ability to show detailed error messages remotely.&nbsp;Note that these last two items are security best practices you really want to follow (otherwise hackers can learn a lot more about the internals of your application than you should show them).<br />For more information on this, please refer: <a href="http://msdn.microsoft.com/en-US/library/ms228298(VS.80).aspx3">http://msdn.microsoft.com/en-US/library/ms228298(VS.80).aspx</a></p>
<p>And, now let us&nbsp;see in what scenario you might want to turn on Debug=True:</p>
<p>ASP.NET supports compiling applications in a special debug mode that facilitates developer troubleshooting. Debug mode causes ASP.NET to compile applications with extra information that enables a debugger to closely monitor and control the execution of an application. Applications that are compiled in debug mode execute as expected. However, the performance of the application is affected. <br />To avoid the effect on performance, it is a good idea to enable debugging only when a developer is doing interactive troubleshooting. By default, debugging is disabled, and although debugging is frequently enabled to troubleshoot a problem, it is also frequently not disabled again after the problem is resolved. So, the best option would be to turn debug=&ldquo;true,&rdquo; fix your problem and turn debug=&ldquo;false&rdquo; back again.</p>
<p>Please refer following article:<br /><a href="http://support.microsoft.com/kb/815157Because">http://support.microsoft.com/kb/815157</a></p>
<p>Because many parts of an ASP.NET application (such as .aspx, .asmx and .ascx pages) are dynamically compiled at run-time, you need to configure the ASP.NET run-time process to compile the application with symbolic information before the application can be debugged. To do this, set the debug attribute in the configuration section of the Web.config file that is located in the root of the application folder to true, as follows:</p>
<p>&lt;configuration&gt;<br />&nbsp;&nbsp;&nbsp; &lt;compile debug=true/&gt;<br />&lt;/configuration&gt;</p>
<p>Alternatively, you can set the Debug attribute of the Page directive to true in your .aspx pages, as follows:</p>
<p>&lt;%@ Page Debug="true" %&gt;</p>
<p>Let's do a small exercise to illustrate why do we really need to set debug=true in your application's configuration.</p>
<p>Add the following code snippet in Page_Load method of Default.aspx of your sample web application. This code will cause a divide-by-zero(as expected) error message whenever you request the page.</p>
<p>Code Snippet:</p>
<p>protected void Page_Load(Object sender, EventArgs e)<br />(<br />&nbsp;&nbsp;&nbsp;&nbsp; int32 i = 0;<br />&nbsp;&nbsp;&nbsp;&nbsp; i = i/0;<br />)</p>
<p>Check the output if you have debug="false" (first) and the same page with debug="true" (second) in Code above.</p>
<p>Output when debug="false"&nbsp; <br />&nbsp;[OverflowException: Arithmetic operation resulted in an overflow.]<br />&nbsp;&nbsp; _Default.Page_Load(Object sender, EventArgs e) +18<br />&nbsp;&nbsp; System.Web.UI.Control.OnLoad(EventArgs e) +99<br />&nbsp;&nbsp; System.Web.UI.Control.LoadRecursive() +47<br />&nbsp;&nbsp; System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061<br />&nbsp;Output when debug="true" <br />&nbsp;<br />&nbsp;<br />&nbsp;[OverflowException: Arithmetic operation resulted in an overflow.]<br />&nbsp;&nbsp; _Default.Page_Load(Object sender, EventArgs e) in C:\My Documents\Visual&nbsp;Studio 2010\WebSites\DebugTrue\Default.aspx.vb:8<br />&nbsp;&nbsp; System.Web.UI.Control.OnLoad(EventArgs e) +99<br />&nbsp;&nbsp; System.Web.UI.Control.LoadRecursive() +47<br />&nbsp;&nbsp; System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061</p>
<p>Notice that with debug=&ldquo;true&rdquo;, you get a more detailed stack output and it even tells you that the problem happened on line number 8 in a page located at C:\My Documents\Visual Studio 2010 Websites\DebugTrue\Default.aspx.vb:8.</p>
<p>If you are a debugger freak and have some knoweldge about WinDbg dump analysis, you should agree with me in my following notes:</p>
<p>To find out if any of the applications on your server run with debug=true you can run a nifty command in sos.dll called !finddebugtrue which will list out all applications where debug=true in the web.config<br />&nbsp;&nbsp;<br />0:016&gt; !finddebugtrue<br />&nbsp;<br />Debug set to true for Runtime: 61b48dc, AppDomain: /SampleApplication<br />&nbsp;<br />Debug set to true for Runtime: 1f50e6d8, AppDomain: /MemoryIssues<br />&nbsp;<br />Total 16 HttpRuntime objects<br />&nbsp;&nbsp;<br />And to find out if you forgot to compile some of your assemblies in release mode run !finddebugmodules<br />&nbsp;<br />0:016&gt; !finddebugmodules<br />&nbsp;<br />Loading all modules.<br />&nbsp;<br />Searching for modules built in debug mode...<br /><br />SampleApplication.dll built debug<br />&nbsp;<br />MemoryIssues.dll built debug<br />&nbsp;<br />fl4sq-9i.dll built debug<br />&nbsp;<br />wepr1t3k.dll built debug<br />&nbsp;<br />r9ocxl4m.dll built debug<br />&nbsp;<br />zmaozzfb.dll built debug</p>
<p>Done Seaching<br />&nbsp;<br />&nbsp;<br />The dlls above with weird 8 character names are the dlls generate when JITing the aspx pages, so they will go away when debug=false.</p>
<p>ScottGu has written an excellent blog on this issue, have a look at the below blog from him:</p>
<p><a href="http://weblogs.asp.net/scottgu/archive/2006/04/11/442448.aspxLet">http://weblogs.asp.net/scottgu/archive/2006/04/11/442448.aspx</a></p>
<p>Have a happy read and share your thoughts.</p>
<p>Let me know if you have any questions and issues on this, I will be happy to answer them.</p>]]></content:encoded>
    </item>
    <item>
      <title>Large file upload issue in ASP.NET</title>
      <link>https://docs.microsoft.com/archive/blogs/prashant_upadhyay/large-file-upload-issue-in-asp-net</link>
      <pubDate>Tue, 12 Jul 2011 16:01:00 GMT</pubDate>
      <dc:creator><![CDATA[PrashantUpadhyay]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/prashant_upadhyay/2011/07/12/large-file-upload-issue-in-asp-net/</guid>
      <description><![CDATA[Off late, I have started getting a lot of complaints why .NET treats files with larger size...]]></description>
      <content:encoded><![CDATA[<p style="text-align: justify;">Off late, I have started getting a lot of complaints why .NET treats files with larger size differently. So, I thought of dedicating some time to do some research on this. What I found out was not something exclusive, but was normal and quite acceptable.</p>
<p style="text-align: justify;">Uploading files via the <a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.aspx">FileUpload</a> control gets tricky with big files. The&nbsp;default maximum filesize is 4MB - this is done to prevent denial of service attacks in which an attacker submitted one or more huge files which overwhelmed server resources. If a user uploads a file larger than 4MB, they'll get an error message: "Maximum request length exceeded."</p>
<p style="text-align: justify;">Here is what needs to&nbsp;be considered for larger file uploads:<br /><br />You can upload files with a combined size of up to 2GB, but it requires some modifications in your application configuration files.<br /><br /><b><span style="text-decoration: underline;">Web.config settings</span></b>:<br /><br />The following attributes can be assigned to the &lt;httpRuntime&gt; tag in the &lt;system.web&gt; section of the Web.config file.<br /><br />1. <b>maxRequestLength </b>: Specifies the limit for the input stream buffering threshold, in KB. This limit can be used to prevent denial of service attacks that are caused, for example, by users posting large files to the server. The default value is 4096 (4 MB). To enable large file uploads you need to change the value of this attribute to the largest allowed combined file size for your application. If someone selects and uploads files with total size larger than maxRequestLength, this will result in a "Page not found" error (which is the default error of the Framework).<br /><br />2. <b>executionTimeout</b> : Specifies the maximum number of seconds that a request is allowed to execute before being automatically shut down by ASP.NET. The value of this setting is ignored in debug mode. The default in .NET Framework 2.0 is 110 seconds. In the .NET Framework 1.0 and 1.1, the default is 90 seconds.<br /><br />To enable large file uploads, which can take large periods of time, increase the value of this property(<b>executionTimeout</b>). <br />&nbsp;<br />For example: The configuration, allowing uploads of files up to 100MB and upload periods up to 1 hour, should look like the following:<br /><br />&lt;configuration&gt;<br /><br />...<br /><br />&lt;system. web&gt; <br /><br />&lt;httpRuntime maxRequestLength="102400" executionTimeout="3600" /&gt;<br /><br />...<br /><br />&lt;/system .web&gt;<br /><br />&lt;/configuration&gt; <br /><br /><b><span style="text-decoration: underline;">IIS7 Settings:</span></b><br /><br />You need to add the following lines in the web.config file: <br /><br />&lt;system.webServer&gt;<br /><br />...<br /><br />&lt;security &gt;<br /><br />&lt;requestFiltering&gt;<br /><br />&lt;requestLimits maxAllowedContentLength="1024000000" /&gt;<br /><br />&lt;/requestFiltering&gt;<br /><br />&lt;/security&gt;<br /><br />&lt;/system.webServer&gt; <br /><br />Open the applicationHost.config(C:\Windows\System32\inetsrv\Configs) file and set the overrideModeDefault property to Allow for the section name = requestFiltering. So now the line should look like:<br /><br />&lt;section name="requestFiltering" overrideModeDefault="Allow" /&gt;</p>
<p style="text-align: justify;">To know more about requestLimits, please refer: <a href="http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits">http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits</a></p>
<p style="text-align: justify;"><b><span style="text-decoration: underline;">Machine.config settings</span></b>:<br /><br />The following attributes can be assigned in the &lt;processModel&gt; element of the machine.config file. They must be set at the machine level, not the application level in web.config.&nbsp;</p>
<p style="text-align: justify;"><br />These properties affect any response deadlock in ASP.NET, not just the application that uploads large files, and should be used with caution.<br /><br /><strong>responseDeadlockInterval</strong><br /><br />Specifies the time interval, in the format HH:MM:SS, after which the process is restarted if the following conditions are met: <br /><br />* There are queued requests.<br /><br />* There has not been a response during this interval. The default is 3 minutes. To allow very large uploads, you may have to increase this value. <br /><br /><strong>responseRestartDeadlockInterval</strong><br /><br />Specifies the time, in the format HH:MM:SS, that must elapse after the last restart to cure a deadlock before the process is restarted to cure a deadlock again. This prevents thrashing on processes that require a relatively long startup time. The default is 9 minutes. To allow very large uploads, you may have to increase this value. <br /><br /><b><span style="text-decoration: underline;">IIS Metabase Settings:</span></b><br /><br />There is one property on IIS 6.0 metabase called <strong>AspMaxRequestEntityAllowed </strong>to allow larger file uploads.<br /><br />The <strong>AspMaxRequestEntityAllowed </strong>property specifies the maximum number of bytes allowed in the entity body of an ASP request. If a Content-Length header is present and specifies an amount of data greater than the value of <strong>AspMaxRequestEntityAllowed</strong>, IIS returns a 403 error response. This property is related in function to <strong>MaxRequestEntityAllowed</strong>, but is specific to ASP request. Whereas you might set the <strong>MaxRequestEntityAllowed </strong>property to 1 MB at the general World Wide Web Publishing Service (WWW Service) level, you may choose to set <strong>AspMaxRequestEntityAllowed </strong>to a lower value, if you know that your specific ASP applications handle a smaller amount of data. <br /><br />I had one such case in my recent past where the customer was getting "HTTP 404: Page Not Found" error when uploading large files on Windows Server 2003 machine. <br /><br />The exact issue was: Sometimes the upload of large files on a Windows 2003 server does not succeed even though the <strong>maxRequestLength </strong>configuration property is set to a very large value. The browser displays<br />"Page Not Found" error. <br /><br />Resolution that worked in my case: Set the IIS Metabase property <strong>AspMaxRequestEntityAllowed to </strong>200000000<br />(~200MB)</p>
<p style="text-align: justify;">Now, let&rsquo;s talk about some scenarios where we get such stuffs:</p>
<p style="text-align: justify;"><b>Error message when you visit a Web site that is hosted on a server that is running Internet Information Services 7.0: "HTTP Error 404.13 - CONTENT_LENGTH_TOO_LARGE"</b></p>
<p style="text-align: justify;">Consider the following scenario. You have a Web site that is hosted on a server that is running Internet Information Services (IIS) 7.0. When a user visits this Web site, the user receives an error message that resembles the following error message:</p>
<p style="text-align: justify;">Server Error in Application "application name"<br /><br />HTTP Error 404.13 - CONTENT_LENGTH_TOO_LARGE<br /><br />HRESULT: 0<br /><br />Description of HRESULT # The operation completed successfully</p>
<p style="text-align: justify;">This problem occurs because the client request contains a Content-Length header that is larger than the value that is specified for this header in the maxAllowedContentLength property in the ApplicationHost.config file.</p>
<p style="text-align: justify;">To resolve this problem, follow these steps:</p>
<ol style="text-align: justify;">
<li>Click Start. In the Start Search box, type Notepad.<br />Right-click Notepad, and then click Run as administrator.<br /><br />Note If you are prompted for an administrator password or for a confirmation,<br />type the password, or click Continue.</li>
<li>On the File menu, click Open. In the File name box,<br />type %windir%\system32\inetsrv\config\applicationhost.config, and then click<br />Open.</li>
<li>In the ApplicationHost.config file, locate the<br />&lt;requestLimits&gt; node.</li>
<li>Remove the maxAllowedContentLength property. Or, add a<br />value that matches the size of the Content-Length header that the client sends<br />as part of the request. By default, the value of the maxAllowedContentLength<br />property is 30000000. <br /><br />For example, modify the following configuration data inside the<br />&lt;requestFiltering&gt; section.</li>
</ol>
<p style="text-align: justify;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;requestLimits maxAllowedContentLength = "&lt;length&gt;" /&gt;</p>
<ol style="text-align: justify;">
<li>Save the ApplicationHost.config file.</li>
</ol>
<p style="text-align: justify;">Courtsey: <a href="http://support.microsoft.com/kb/942074">http://support.microsoft.com/kb/942074</a></p>
<p style="text-align: justify;">You can get some scenarios in the below article, please refer this;</p>
<p style="text-align: justify;"><a href="http://forums.iis.net/t/1066272.aspx">http://forums.iis.net/t/1066272.aspx</a></p>]]></content:encoded>
    </item>
  </channel>
</rss>