Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Is it possible to restart Asp.net web application programmatically when it will became very slow processing state (more than one min) state...? A traditional way of doing so is to edit the web.config slightly (a space, comma, fullstop would do the trick) … but now i want programmatically...help me friends...This my web config code...


XML
<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
	<appSettings>
		<add key="Productivity" value="Data Source=xxxxx; Initial Catalog=Transcription WorkFlow; uid=xxxxx;pwd=xxxxxx;Connect Timeout=45"/>		
	</appSettings>
	<connectionStrings>
		<add name="ApplicationServices" connectionString="Data Source=xxxxx; Initial Catalog=Transcription WorkFlow; uid=xxxxx;pwd=xxxxx"/>
	</connectionStrings>
	<system.web>
		<customErrors mode="Off"/>
		<httpRuntime appRequestQueueLimit="50" executionTimeout="300"/>
		<httpHandlers>
      <add verb="*" path="*js.axd" type="ScriptCompressorHandler" />			
		</httpHandlers>
    <httpModules>
      <add name="RequestReduce"  type="RequestReduce.Module.RequestReduceModule, RequestReduce" />
      <add type="ScriptCompressorModule" name="ScriptCompressorModule" />
    </httpModules>		
		<compilation debug="false">
			<assemblies>
				<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
				<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
				<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
				<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
				<add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
				<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
				<add assembly="System.Data.Services.Client, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Data.Services.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies>
		</compilation>
		<trace pageOutput="false" requestLimit="10" enabled="false" localOnly="true" traceMode="SortByTime" mostRecent="true"/>
		<authentication mode="Windows"/>
		<membership>
			<providers>
				<clear/>
				<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="Productivity Diary"/>
			</providers>
		</membership>
		<profile enabled="true" automaticSaveEnabled="false">
			<providers>
				<clear/>
				<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="Productivity Diary"/>
			</providers>
		</profile>
		<roleManager enabled="true" cacheRolesInCookie="true">
			<providers>
				<clear/>
				<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="Productivity Diary"/>
				<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="Productivity Diary"/>
			</providers>
		</roleManager>
	</system.web>
	<runtime>
		<generatePublisherEvidence enabled="false"/>
	</runtime>
	<system.web.extensions>
		<scripting>
			<scriptResourceHandler enableCompression="true" enableCaching="true"/>
		</scripting>
	</system.web.extensions>
	<system.webServer>
    <httpCompression>
      <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
      <dynamicTypes>
        <add mimeType="text/*" enabled="true"/>
        <add mimeType="message/*" enabled="true"/>
        <add mimeType="application/javascript" enabled="true"/>
        <add mimeType="*/*" enabled="false"/>
      </dynamicTypes>
      <staticTypes>
        <add mimeType="text/*" enabled="true"/>
        <add mimeType="message/*" enabled="true"/>
        <add mimeType="application/javascript" enabled="true"/>
        <add mimeType="*/*" enabled="false"/>
      </staticTypes>
    </httpCompression>
    <urlCompression doStaticCompression="true" doDynamicCompression="true"/>
    <modules>
      <add name="RequestReduce" type="RequestReduce.Module.RequestReduceModule, RequestReduce" />
    </modules>
		<!--<modules runAllManagedModulesForAllRequests="false"/>-->
		<validation validateIntegratedModeConfiguration="false"/>		
	</system.webServer>
</configuration>
Posted
Updated 7-Oct-13 19:32pm
v2

1 solution

You should find the reason why the website getting slow. By find & fixing that you could get rid of these issues. Check this post for sample reasons.

ASP.NET Performance: Web Application Gets Slow Periodically – IIS Recycles[^]

Anyway for your question, take a look at this article
Stop/Start IIS Website in .NET (C#)[^]

EDIT
-------------------
Here a lot, dig those
My Web Site is so slow… And I don't know what to do about it![^]
Common performance issues on ASP.NET web sites[^]
 
Share this answer
 
v2
Comments
Mohancs27 8-Oct-13 1:28am    
In My Web Application,multi-user working in same time .So Application pool restart introduce some problems .Please Tell another idea...Thanks any way...
thatraja 8-Oct-13 2:57am    
Check my updated answer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900