2 Replies - 6340 Views - Last Post: 24 December 2009 - 10:02 PM Rate Topic: -----

#1 oasisjoel  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 274
  • Joined: 11-September 08

Time out when call my webService

Posted 23 December 2009 - 08:27 PM

Hello again guys, Good to be back


Hope you could help with my problem. I created a webApplication that generate a report. My problem is when the data coming from dataBase is very big it say this error " System.Net.WebException: The operation has timed-out" when calling my WebService. Everything run in my localhost except for my Database.

Here is my webConfig for my Web Applciation

<?xml version="1.0" encoding="utf-8"?>
<configuration>

	<configSections>

			<!-- ZZZCSharpClassLibrary Settings (BEGIN 1 of 3) -->

			<!-- ZZZ.Logger settings (1/3): -->
					<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>

			<!-- ZZZCSharpClassLibrary Settings (END 1 of 3) -->		

	</configSections>
	
	<appSettings>

			<!-- Component Release Control: -->			
					<add key="ComponentName" value="BHKSysWeb"/>
					<add key="ComponentRelease" value="rev003"/>


			<!-- Security Settings: -->						
			<!-- Web login permission, allowed groups (CSV values) -->
					<add key="AllowedWebPermissions" value="ADMINISTRATOR,MANAGEMENT,CRMUSERS"/>
									
			<!-- WebServices Connection strings: -->
		
			<!-- Development (enabled) -->	
				<add key="BHKSysWeb.WebReferences.BHKCrmService.Service1.Service1" value="http://127.0.0.1:40001/BHK/BHKCrmService/Service1.asmx"/>
				<add key="BHKSysWeb.WebReferences.BHKCdrService.Service1.Service1" value="http://192.168.140.182/BHK/BHKCdrService/Service1.asmx"/>	
				<add key="BHKSysWeb.WebReferences.BHKBilService.Service1.Service1" value="http://127.0.0.1:40001/BHK/BHKBilService/Service1.asmx"/>			
			<!-- (enabled) Development -->
			<!-- Production (disabled) 
				<add key="BHKSysWeb.WebReferences.BHKCrmService.Service1.Service1" value="http://127.0.0.1:20001/BHK/BHKCrmService/Service1.asmx"/>
				<add key="BHKSysWeb.WebReferences.BHKCdrService.Service1.Service1" value="http://127.0.0.1:20001/BHK/BHKCdrService/Service1.asmx"/>
				<add key="BHKSysWeb.WebReferences.BHKBilService.Service1.Service1" value="http://127.0.0.1:20001/BHK/BHKBilService/Service1.asmx"/>	
			(disabled) Production -->

						
			<!-- WebPage Settings: -->			
					<add key="RootUrl" value="/BHK/BHKSysWeb/"/>
					<add key="PageExpiresInMinutes" value="0"/>
			<!-- 
						Physical location of Xml file to make Breadcrumbs.
						Contains SiteMap only with Representative pages.
						Replacement placeholders:
						{Path} - Replaced with something like "c:/IISPhysicalPath/BHKSysWebPhysicalPath/SiteMapPhysicalPath".
			-->
					<add key="SiteMapPath" value="{Path}/Sitemap.xml"/>
			<!-- Development (enabled) -->
					<add key="ReportTempFolder" value="D:\TestStorage\BHK\BHKSysWeb\Reports\"/>
			<!-- (enabled) Development -->
			<!-- Production (disabled) 
					<add key="ReportTempFolder" value="D:\Storage\BHK\BHKSysWeb\Reports\"/>
			(disabled) Production -->
				
			<!-- 
						Indicate if the current application is in test mode.
			-->								
					<!-- Development (enabled) -->
							<add key="TestMode" value="on"/>
					<!-- (enabled) Development -->
					<!-- Production (disabled) 
							<add key="TestMode" value="off"/>
					(disabled) Production -->
					
			<!-- 
						Use this setting to enable autologin
						for the user that was already authenticated by windows
			-->								
					<!-- Development (enabled) -->
							<add key="AutoLogin" value="off"/>
					<!-- (enabled) Development -->
					<!-- Production (disabled) 
							<add key="AutoLogin" value="off"/>
					(disabled) Production -->
			
			<!-- 
						Period of time in minutes for caching data 
			-->
					<add key="CacheDurationInMinutes" value="10"/>
			
					
			<!-- ZZZCSharpClassLibrary Settings (BEGIN 2 of 3) -->

					<!-- Logging Settings: -->

					<!-- 
								Maximum entries to be logged to Windows Event Log per hour 
								(to avoid excessive logging	and thus excessive Event Log monitor e-mails). 
								- Set to zero or comment this out to allow unlimited logging.
								- See ZZZ.Util.WriteEventLogEntry for details.
					-->
							<add key="ZZZ.MaxEventLogEntriesPerHour" value="5"/>

					<!-- ZZZ.Logger settings (2/3): -->

					<!-- 
								Folder to hold log files. Your should change this to your component name or something similar.
								By default, it is safe to have 2 or more different application instances (OS processes) 
								writing into the same folder (Windows ProcessID is part of filename).
								- IMPORTANT: If you change this folder, you should also update log4net setup below 
								(param name="file" value="....").
					-->
					<!-- Development (enabled) -->
							<add key="ZZZ.Logger.LogsFolder" value="D:\TestStorage\BHK\BHKSysWeb\Logs"/>
					<!-- (enabled) Development -->
					<!-- Production (disabled) 
							<add key="ZZZ.Logger.LogsFolder" 
									value="D:\Storage\BHK\BHKSysWeb\Logs"/>
					(disabled) Production -->

					<!-- 
								Folder to hold old log files, which are zipped (with ICSharpCode.SharpZipLib.dll) or not, 
								depending on the setting [ZZZ.Logger.ZipOldLogsFilesBeforeDeleting] defined next. 
								Your should change this to your component name or something similar.
					-->
					<!-- Development (enabled) -->
							<add key="ZZZ.Logger.OldLogsFolder" value="D:\TestStorage\BHK\BHKSysWeb\Logs\OldLogs"/>
					<!-- (enabled) Development -->
					<!-- Production (disabled) 
							<add key="ZZZ.Logger.OldLogsFolder" 
								value="D:\Storage\BHK\BHKSysWeb\Logs\OldLogs"/>
					(disabled) Production -->

					<!-- 
								How many megabytes of files to keep in Logs folder.
								- Set to zero or comment out this setting to disable automatic file deleting.
								- Oldest files are deleted first.
								- Automatic file deleting will allow only up to 5000 files in the log folder
								(delete will happen independent of used megabytes if needed).
								- Please realize that deleting of old log files happens only from time to time,
								meaning that you will temporarily have more log files (and used disk space)
								than the amount specified below. See ZZZ.Logger class for details.
					-->
							<add key="ZZZ.Logger.MaxLogMegabytesToKeep" value="250"/>

					<!-- 
								How many megabytes of files to keep in OldLogs folder.
								- Set to zero or comment out this setting to disable automatic file deleting.
								- Oldest files are deleted first.
								- Automatic file deleting will allow only up to 5000 files in the log folder
								(delete will happen independent of used megabytes if needed).
								- Please realize that deleting of old log files happens only from time to time,
								meaning that you will temporarily have more log files (and used disk space)
								than the amount specified below. See ZZZ.Logger class for details.

								IMPORTANT: Since the zipping turns the files to be very small 
								(less than 1% of the original file size), the number 
								of files in the folder can increase considerably. For that reason, try to use
								values here not higher than 10% of the [ZZZ.Logger.MaxLogMegabytesToKeep].
					-->
							<add key="ZZZ.Logger.MaxOldLogMegabytesToKeep" value="25"/>

					<!-- 
					Defines if the old logs should be moved to the OldLogs folder instead of being directly deleted.
					If enabled, the deletion of the logs will be controlled in the OldLogs folder instead.
					Use "yes" to enable this feature, or comment or put anything else to disable it.
					-->
							<add key="ZZZ.Logger.MoveOldLogsFilesToOldLogsFolder" value="yes"/>

					<!-- 
								Key to define if ZZZ.Logger should send warnings/errors to Windows Event Log or not,
								using ZZZ.Util.WriteEventLogEntry method.
								- Set to "yes" to send error/warnings to Windows Event Log also.
								- Comment it out or set it to anything else to log error/warnings only in log files. 
								- To avoid spam (thousands of entries) into Windows Event Log,
								if you enable this also consider setting ZZZ.MaxEventLogEntriesPerHour
								(see ZZZ.Util for details).
					-->
							<add key="ZZZ.Logger.SendErrorsAndWarningsToWindowsEventLog" value="yes"/>

			<!-- ZZZCSharpClassLibrary Settings (END 2 of 3) -->

	</appSettings>

			<!-- ZZZCSharpClassLibrary Settings (BEGIN 3 of 3) -->

					<!-- ZZZ.Logger settings (3/3): -->

					<log4net debug="false">
							<appender name="Rolling" type="log4net.Appender.RollingFileAppender">
								<!-- 
											If you change file folder, you should change key ZZZ.Logger.LogsFolder above also.
											- IMPORTANT: Be careful to use double-backslashes (\\).
											- The tokens after %appdomain (inclusive) make up the filename itself.
											It is kind of long but we recommed you keep it as it is.
											- The %processid token is required in case you are going to have 
											multiple OS processes (e.g. application instances and/or IIS worker processes)
											running simultaneously and pointing to same log folder. 
								-->
								<!-- Development (enabled) -->
										<param name="file" type="log4net.Util.PatternString" value="D:\\TestStorage\\BHK\\BHKSysWeb\\Logs\\BHKSysWeb Start %date{yyyyMMdd-HHmmss}, Computer %env{COMPUTERNAME}, ProcessID %processid,"/>
								<!-- (enabled) Development -->
								<!-- Production (disabled) 
										<param name="file" type="log4net.Util.PatternString" 
												value="D:\\Storage\\BHK\\BHKSysWeb\\Logs\\BHKSysWeb Start %date{yyyyMMdd-HHmmss}, Computer %env{COMPUTERNAME}, ProcessID %processid,"/>
								(disabled) Production -->
								
								<!-- 
											You should probably set this as 100MB if you set ZZZ.Logger.MaxLogMegabytesToKeep
											to 10000 (10GB) or more. Reason: Auto-delete of old log files requires
											not-so-many (around 1000 or less) log files in your logs folder, due to performance issues.
								-->
										<param name="maximumFileSize" value="10MB"/>
								<!-- We recommend avoiding changes in other settings in this section. -->
										<param name="appendToFile" value="true"/>
										<param name="countDirection" value="1"/>
										<param name="datePattern" value="' 'yyyyMMdd'.log'"/>
										<param name="maxSizeRollBackups" value="-1"/>
										<param name="rollingStyle" value="Composite"/>
										<param name="staticLogFileName" value="false"/>					
										<layout type="log4net.Layout.PatternLayout">
											<param name="ConversionPattern" value="%date [%thread] %-5level - %message%newline"/>
										</layout>
								</appender>
								<root>
										<priority value="DEBUG"/>
										<appender-ref ref="Rolling"/>
								</root>
					</log4net>

			<!-- ZZZCSharpClassLibrary Settings (END 3 of 3) -->
		
	<system.web>
			
			<!--  DYNAMIC DEBUG COMPILATION
						Set compilation debug="true" to enable ASPX debugging.  Otherwise, setting this value to
						false will improve runtime performance of this application. 
						Set compilation debug="true" to insert debugging symbols (.pdb information)
						into the compiled page. Because this creates a larger file that executes
						more slowly, you should set this value to true only when debugging and to
						false at all other times. For more information, refer to the documentation about
						debugging ASP.NET files.
						-->
			<compilation defaultLanguage="c#" debug="true"> </compilation>

			<!--  CUSTOM ERROR MESSAGES
						Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable. 
						Add <error> tags for each of the errors you want to handle.

						"On" Always display custom (friendly) messages.
						"Off" Always display detailed ASP.NET error information.
						"RemoteOnly" Display custom (friendly) messages only to users not running 
						on the local Web server. This setting is recommended for security purposes, so 
						that you do not display application detail information to remote clients.
			-->

			<customErrors mode="Off">
				<error statusCode="404" redirect="Error.aspx"/>
			</customErrors> 

			<!--  AUTHENTICATION 
						This section sets the authentication policies of the application. Possible modes are "Windows", 
						"Forms", "Passport" and "None"

						"None" No authentication is performed. 
						"Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to 
						its settings for the application. Anonymous access must be disabled in IIS. 
						"Forms" You provide a custom form (Web page) for users to enter their credentials, and then 
						you authenticate them in your application. A user credential token is stored in a cookie.
						"Passport" Authentication is performed via a centralized authentication service provided
						by Microsoft that offers a single logon and core profile services for member sites.
			-->
			<authentication mode="Windows"/> 

			<!--  AUTHORIZATION 
						This section sets the authorization policies of the application. You can allow or deny access
						to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous 
						(unauthenticated) users.
			-->

			<authorization>
					<allow users="*"/> <!-- Allow all users -->
			<!--  <allow	 users="[comma separated list of users]"
						roles="[comma separated list of roles]"/>
						<deny	  users="[comma separated list of users]"
						roles="[comma separated list of roles]"/>
			-->
			</authorization>

			<!--  APPLICATION-LEVEL TRACE LOGGING
						Application-level tracing enables trace log output for every page within an application. 
						Set trace enabled="true" to enable application trace logging.  If pageOutput="true", the
						trace information will be displayed at the bottom of each page.  Otherwise, you can view the 
						application trace log by browsing the "trace.axd" page from your web application
						root. 
			-->
			<trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true"/>

			<!--  SESSION STATE SETTINGS
						By default ASP.NET uses cookies to identify which requests belong to a particular session. 
						If cookies are not available, a session can be tracked by adding a session identifier to the URL. 
						To disable cookies, set sessionState cookieless="true".
			-->
			<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="300000"/>

			<!--  GLOBALIZATION
						This section sets the globalization settings of the application. 
			-->
			<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>

	</system.web>

</configuration>





While here is my code for my main Application

[code]
using System;
using System.Web.UI.WebControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

namespace BHKSysWeb.CallReports
{
/// <summary>
/// Summary description for Report.
/// </summary>
public class Report : Helpers.WebPageBase
{
#region Constructors
#endregion
#region Properties

/// <summary>
/// Type of the report.
/// </summary>
protected System.Web.UI.WebControls.DropDownList ddlReportType;
/// <summary>
/// Page title.
/// </summary>
protected System.Web.UI.WebControls.Label lblHeader;
/// <summary>
/// Reference date.
/// </summary>
protected System.Web.UI.HtmlControls.HtmlInputText txtDateReference;
/// <summary>
/// Initiate the process.
/// </summary>
protected System.Web.UI.HtmlControls.HtmlInputButton btnGenerate;
/// <summary>
/// Display error messages.
/// </summary>
protected System.Web.UI.WebControls.Label lblErrorMessage;
/// <summary>
/// Display result messages.
/// </summary>
protected System.Web.UI.WebControls.Label lblResultMessage;

#endregion
#region Methods

/// <summary>
/// Overrides the <see cref="Helpers.WebPageBase"/>.OnInit, which initialize components.
/// </summary>
/// <param name="e">The arguments.</param>
override protected void
OnInit(EventArgs e)
{
base.OnInit(e);
this.btnGenerate.ServerClick += new System.EventHandler(this.btnGenerate_Click);
this.ddlReportType.SelectedIndexChanged += new System.EventHandler(this.ddlReportType_SelectedIndexChanged);
}

/// <summary>
/// Generate report.
/// </summary>
/// <param name="sender">The sender object.</param>
/// <param name="e">The arguments.</param>
private void
btnGenerate_Click(object sender, System.EventArgs e)
{
#region Validation

ReportClass objReport;
System.DateTime dateReference;
System.Data.DataSet result;
string reportName="";
string [email protected]"d:\";
try
{
dateReference = DateTime.Parse(txtDateReference.Value);
}
catch
{
lblErrorMessage.Text = "Invalid reference date.";
lblResultMessage.Text = "";
return;
}

#endregion
#region Call webservice

try
{
if (ddlReportType.SelectedIndex == 1)
{
result = Helpers.Common.GetCallBackReport(dateReference, dateReference);
objReport = new GeneralCallReport();
}
else if (ddlReportType.SelectedIndex == 2)
{
result = Helpers.Common.GetGeneralCallReport(dateReference, dateReference);
 &nbs

Is This A Good Question/Topic? 0
  • +

Replies To: Time out when call my webService

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 5074
  • View blog
  • Posts: 13,697
  • Joined: 18-April 07

Re: Time out when call my webService

Posted 24 December 2009 - 12:07 AM

Well if you are requesting a lot of information from the service and it is all required for the report, the only real option you have is to either 1) Refine the request and ask for less info or 2) Adjust the executionTimeout property in the web.config on the server to be a higher timeout value. Also make sure that nothing is erroring out in the web service that is just manifesting itself as some kind of error on the client application.

:)
Was This Post Helpful? 0
  • +
  • -

#3 oasisjoel  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 274
  • Joined: 11-September 08

Re: Time out when call my webService

Posted 24 December 2009 - 10:02 PM

Yo Martyr I already try to increase the timeout execution time..

Here is my code..


<trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true"/>

			<!--  SESSION STATE SETTINGS
						By default ASP.NET uses cookies to identify which requests belong to a particular session. 
						If cookies are not available, a session can be tracked by adding a session identifier to the URL. 
						To disable cookies, set sessionState cookieless="true".
			-->
			[b]<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="[u]300000[/u]"/>[/b]

			<!--  GLOBALIZATION
						This section sets the globalization settings of the application. 
			-->
			<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>


<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="300000"/>
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1