I'm encountering some strange behavior after deploying a ASP.net 3.5 website
to production, i'm unable to reproduce these in my dev environment. This
error seems to occur very randomly but it's occuring enough to be a real
cause for concern. The errors occur a couple times a week and the website is
hit with constant traffic 24x7. Below are the two errors that are
encountered. I had read something about MARS causing errors like this but
since LINQ-to-SQL is a black box in how it works with ADO.net this is proving
to be difficult to troubleshoot, any help would be greatly appreciated.
Error Messages:
"There is already an open DataReader associated with this Command which must
be closed first."
stack trace:
at
System.Data.Sql Client.SqlInter nalConnectionTd s.ValidateConne ctionForExecute (SqlCommand
command) at
System.Data.Sql Client.SqlConne ction.ValidateC onnectionForExe cute(String
method, SqlCommand command) at
System.Data.Sql Client.SqlComma nd.ValidateComm and(String method, Boolean
async) at System.Data.Sql Client.SqlComma nd.RunExecuteRe ader(CommandBeh avior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method,
DbAsyncResult result) at
System.Data.Sql Client.SqlComma nd.RunExecuteRe ader(CommandBeh avior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at
System.Data.Sql Client.SqlComma nd.ExecuteReade r(CommandBehavi or behavior,
String method) at
System.Data.Sql Client.SqlComma nd.ExecuteDbDat aReader(Command Behavior
behavior) at System.Data.Com mon.DbCommand.E xecuteReader() at
System.Data.Lin q.SqlClient.Sql Provider.Execut e(Expression query, QueryInfo
queryInfo, IObjectReaderFa ctory factory, Object[] parentArgs, Object[]
userArgs, ICompiledSubQue ry[] subQueries, Object lastResult) at
System.Data.Lin q.SqlClient.Sql Provider.Execut eAll(Expression query,
QueryInfo[] queryInfos, IObjectReaderFa ctory factory, Object[] userArguments,
ICompiledSubQue ry[] subQueries) at
System.Data.Lin q.SqlClient.Sql Provider.System .Data.Linq.Prov ider.IProvider. Execute(Express ion
query) at System.Data.Lin q.DataContext.E xecuteMethodCal l(Object instance,
MethodInfo methodInfo, Object[] parameters) at
System.Data.Lin q.DataContext.E xecuteQuery[TResult](String query, Object[]
parameters) at
SystemLayer.Fac toryView.DAL.Se arch.SearchCont roller.getFctys ByFullTextFilte r(String
filterArgs, String rowsPerPage, String rowsBeforeThisP age, Int32&
totalResultCoun t)
"Invalid attempt to call FieldCount when reader is closed."
stack trace:
at System.Data.Sql Client.SqlDataR eader.get_Field Count() at
System.Data.Lin q.SqlClient.Obj ectReaderCompil er.ObjectReader Base`1.GetColum nOrdinals(Named Column[]
namedColumns) at
System.Data.Lin q.SqlClient.Obj ectReaderCompil er.ObjectReader Base`1..ctor(Ob jectReaderSessi on`1
session, NamedColumn[] namedColumns, Object[] globals, Object[] arguments,
Int32 nLocals) at
System.Data.Lin q.SqlClient.Obj ectReaderCompil er.ObjectReader Session`1.Creat eReader[TObject](Func`2
fnMaterialize, NamedColumn[] namedColumns, Object[] globals, Int32 nLocals,
Boolean disposeDataRead er) at
System.Data.Lin q.SqlClient.Obj ectReaderCompil er.ObjectReader Factory`2.Creat e(DbDataReader
dataReader, Boolean disposeDataRead er, IReaderProvider provider, Object[]
parentArgs, Object[] userArgs, ICompiledSubQue ry[] subQueries) at
System.Data.Lin q.SqlClient.Sql Provider.Execut e(Expression query, QueryInfo
queryInfo, IObjectReaderFa ctory factory, Object[] parentArgs, Object[]
userArgs, ICompiledSubQue ry[] subQueries, Object lastResult) at
System.Data.Lin q.SqlClient.Sql Provider.Execut eAll(Expression query,
QueryInfo[] queryInfos, IObjectReaderFa ctory factory, Object[] userArguments,
ICompiledSubQue ry[] subQueries) at
System.Data.Lin q.SqlClient.Sql Provider.System .Data.Linq.Prov ider.IProvider. Execute(Express ion
query) at System.Data.Lin q.DataContext.E xecuteMethodCal l(Object instance,
MethodInfo methodInfo, Object[] parameters) at
System.Data.Lin q.DataContext.E xecuteQuery[TResult](String query, Object[]
parameters) at
SystemLayer.Fac toryView.DAL.Se arch.SearchCont roller.getFctys ByFullTextFilte r(String
filterArgs, String rowsPerPage, String rowsBeforeThisP age, Int32&
totalResultCoun t)
to production, i'm unable to reproduce these in my dev environment. This
error seems to occur very randomly but it's occuring enough to be a real
cause for concern. The errors occur a couple times a week and the website is
hit with constant traffic 24x7. Below are the two errors that are
encountered. I had read something about MARS causing errors like this but
since LINQ-to-SQL is a black box in how it works with ADO.net this is proving
to be difficult to troubleshoot, any help would be greatly appreciated.
Error Messages:
"There is already an open DataReader associated with this Command which must
be closed first."
stack trace:
at
System.Data.Sql Client.SqlInter nalConnectionTd s.ValidateConne ctionForExecute (SqlCommand
command) at
System.Data.Sql Client.SqlConne ction.ValidateC onnectionForExe cute(String
method, SqlCommand command) at
System.Data.Sql Client.SqlComma nd.ValidateComm and(String method, Boolean
async) at System.Data.Sql Client.SqlComma nd.RunExecuteRe ader(CommandBeh avior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method,
DbAsyncResult result) at
System.Data.Sql Client.SqlComma nd.RunExecuteRe ader(CommandBeh avior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at
System.Data.Sql Client.SqlComma nd.ExecuteReade r(CommandBehavi or behavior,
String method) at
System.Data.Sql Client.SqlComma nd.ExecuteDbDat aReader(Command Behavior
behavior) at System.Data.Com mon.DbCommand.E xecuteReader() at
System.Data.Lin q.SqlClient.Sql Provider.Execut e(Expression query, QueryInfo
queryInfo, IObjectReaderFa ctory factory, Object[] parentArgs, Object[]
userArgs, ICompiledSubQue ry[] subQueries, Object lastResult) at
System.Data.Lin q.SqlClient.Sql Provider.Execut eAll(Expression query,
QueryInfo[] queryInfos, IObjectReaderFa ctory factory, Object[] userArguments,
ICompiledSubQue ry[] subQueries) at
System.Data.Lin q.SqlClient.Sql Provider.System .Data.Linq.Prov ider.IProvider. Execute(Express ion
query) at System.Data.Lin q.DataContext.E xecuteMethodCal l(Object instance,
MethodInfo methodInfo, Object[] parameters) at
System.Data.Lin q.DataContext.E xecuteQuery[TResult](String query, Object[]
parameters) at
SystemLayer.Fac toryView.DAL.Se arch.SearchCont roller.getFctys ByFullTextFilte r(String
filterArgs, String rowsPerPage, String rowsBeforeThisP age, Int32&
totalResultCoun t)
"Invalid attempt to call FieldCount when reader is closed."
stack trace:
at System.Data.Sql Client.SqlDataR eader.get_Field Count() at
System.Data.Lin q.SqlClient.Obj ectReaderCompil er.ObjectReader Base`1.GetColum nOrdinals(Named Column[]
namedColumns) at
System.Data.Lin q.SqlClient.Obj ectReaderCompil er.ObjectReader Base`1..ctor(Ob jectReaderSessi on`1
session, NamedColumn[] namedColumns, Object[] globals, Object[] arguments,
Int32 nLocals) at
System.Data.Lin q.SqlClient.Obj ectReaderCompil er.ObjectReader Session`1.Creat eReader[TObject](Func`2
fnMaterialize, NamedColumn[] namedColumns, Object[] globals, Int32 nLocals,
Boolean disposeDataRead er) at
System.Data.Lin q.SqlClient.Obj ectReaderCompil er.ObjectReader Factory`2.Creat e(DbDataReader
dataReader, Boolean disposeDataRead er, IReaderProvider provider, Object[]
parentArgs, Object[] userArgs, ICompiledSubQue ry[] subQueries) at
System.Data.Lin q.SqlClient.Sql Provider.Execut e(Expression query, QueryInfo
queryInfo, IObjectReaderFa ctory factory, Object[] parentArgs, Object[]
userArgs, ICompiledSubQue ry[] subQueries, Object lastResult) at
System.Data.Lin q.SqlClient.Sql Provider.Execut eAll(Expression query,
QueryInfo[] queryInfos, IObjectReaderFa ctory factory, Object[] userArguments,
ICompiledSubQue ry[] subQueries) at
System.Data.Lin q.SqlClient.Sql Provider.System .Data.Linq.Prov ider.IProvider. Execute(Express ion
query) at System.Data.Lin q.DataContext.E xecuteMethodCal l(Object instance,
MethodInfo methodInfo, Object[] parameters) at
System.Data.Lin q.DataContext.E xecuteQuery[TResult](String query, Object[]
parameters) at
SystemLayer.Fac toryView.DAL.Se arch.SearchCont roller.getFctys ByFullTextFilte r(String
filterArgs, String rowsPerPage, String rowsBeforeThisP age, Int32&
totalResultCoun t)