gaurav singh

gaurav singh

  • NA
  • 65
  • 20.3k

Got Exception while Reading DB by WCF Service

Mar 12 2015 3:53 AM
Hi Dear,
I have face got so many times error, while reading data from Database using WCF service. Pl. any one suggest me. why this error has been raised many time.

Bellow line of code,we have got such excepiton

  public Transaction Get(int TransactionID)
        {
            Transaction _transaction = new Transaction();
            using (SqlConnection connection = new SqlConnection(DbConnectionSettings.ConnectionStringReadDatabase))
            {
                connection.Open();
                try
                {
                    using (IDataReader idr = SqlHelper.ExecuteReader(connection, "dbo.usp_DTTransactionGet", TransactionID, false))
                    if (idr.Read())
                    {
                        _transaction = AssignPropertyValues(idr);                       
                    }
                }
                catch (Exception ex)
                {
                    Log.Exception("Exception in ServiceCore.DTTransaction.Get() ", ex);

                }               
            }
            return _transaction;
        }


Exception in Repository.DTTransaction.Get(). TransactionId:
26397149Exception : System.Data.SqlClient.SqlException (0x80131904): Timeout
expired. The timeout period elapsed prior to completion of the operation or
the server is not responding. ---> System.ComponentModel.Win32Exception
(0x80004005): The wait operation timed out
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception,
Boolean breakConnection, Action`1 wrapCloseInAction)
at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjec
t stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet
bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
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,
Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method,
TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean
asyncWrite)
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.ExecuteReader()
at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(SqlConnection
connection, SqlTransaction transaction, CommandType commandType, String
commandText, SqlParameter[] commandParameters, SqlConnectionOwnership
connectionOwnership)
at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(SqlConnection
connection, CommandType commandType, String commandText, SqlParameter[]
commandParameters)
at Repositories.TransactionRepository.Get(Int32 TransactionID) in
c:\Builds\127\FPServices\090.Finance.00Live.ADSProvider.Gated\Sources\02.Tea
ms\090.Finance\AdditionalServicesProvider\00.Live\DataAccessLayer\Transactio
n\TransactionRepository.cs:line 23
ClientConnectionId:eab68fcf-53e2-40ee-915d-5827167b7cb8
 

Answers (2)