When you search via Google, they aren't going off and hunting for matches on the web at that point. They search their indexed versions, which they have previously crawled. You need to take a similar approach in order to satisfy your requirement.
I was brought up to respect my elders. I don't respect many people nowadays.
I am running a C# 2010 windows application that calls a C# 2008 console application to make various calls to a web service. I am getting the following timeout error. I am wondering what part of the application I should look at to determine what is causing the timeout? Both applications are compiled in debug mode.
I am wondering if you can tell in the application what timeout parameter(s) need to be changed? What coding changes would I make to prevent the timeout errors from occuring?
Here is the error message:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
2013-01-2416:40:03.3082|ERROR|Sample|************* Stack Trace *******************
2013-01-2416:40:03.3238|ERROR|Sample| at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object parentArgs, Object userArgs, ICompiledSubQuery subQueries, Object lastResult)
at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo queryInfos, IObjectReaderFactory factory, Object userArguments, ICompiledSubQuery subQueries)
at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
at System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
As your stack trace mentions SQLClient in almost every line I would suspect it is your database query that is timing out, that will live in your WCF. You can change both the the connection timeout and/or the command timeout.
Never underestimate the power of human stupidity
I am wondering what part of the application I should look at to determine what is causing the timeout
If it is a large application and especially if it is a system (multiple applications like you're having) you might want to consider some serious logging. The timestamps in the log can immediately tell you where the culprit is.
I suggest thinking the logging mechanism over for a while before jumping in a quick and dirty solution. Good logging saved my day in numerous times.
What coding changes would I make to prevent the timeout errors from occuring?
What you need to do FIRST is determine what is being processed (presuming some SQL.)
The SECOND you need to determine what a reasonable time for that process to take - especially from the business side.
As an example it unreasonable to expect a user to wait for an hour for a web site to finish processing a request (where the web app is blocked until it is done.)
To "fix" a problem like this depends on the specifics of the problem but some or all of the following might be necessary but this is not a complete list.
- Tune the database/schema
- Adjust the SQL operation parameters or SQL itself.
- Rearch/design the interface to preclude such operations.
- Rearch/design the interface to create a batch processing system where a request is posted, some other process processes each request, and some time later a result is created, then the caller at some later time, may submit another (different) request to retrieve the result.
It is never easy!! We have a response file which has two types of decisions, ACCEPT and DECLINE with in the comma separated name/value pair. I am inserting this information in to the database and want only the decision ACCEPT. In cases in line contains DECLINE, I want to skip this current line and go to the next line.
using (StreamReader sr = new StreamReader(path))
while (sr.Peek() > -1)
string line = sr.ReadLine();
//extract the line contents
if( line.Contains("Accept")) // you can replace the condition with your choice
//Do Insert to database
Can you share the code how you invoke the SaveFileDialog, in my application its in front of the Winform UI.
It's the same SaveFileDialog with an additional button "Help" pressing the Help button should display a page on how to use this dialog. however when i tested in my PC pressing the Help buttons pops nothing.
Can you share the code how you invoke the SaveFileDialog
if (saveProjectDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
But I just found out it isn't just the SaveFileDialog doing it. Every MessageBox is doing the same. (No, nothing in the project is set to TopMost.)
I don't have anywhere to post screen captures at the moment, but the dialogs are different when ShowHelp is used or not. One is a huge Windows 7 Explorer-ish box, the other is a small dialog with the 5 icons down the left side for Recent Places, Desktop, Libraries, Computer, Network.