Database errors
-
Wednesday, July 20, 2011 2:03 PM
I developed a wrapper service for MDS API (also a WCF), in order to simplify operation calls and make the service available for a custom tool.
Sometimes I get the following sequence of errors, I would like to know from the development team if these rings a bell.
System.InvalidOperationException: Invalid attempt to call MetaData when reader is closed.
at Microsoft.MasterDataServices.Core.DataAccess.DbHelper.HandleExceptions(Exception ex)
at Microsoft.MasterDataServices.Core.DataAccess.DbHelper.ExecuteXmlDeserializer[T](String sprocName, CloseConnectionBehavior closeBehavior, Object[] parameterValues)
at Microsoft.MasterDataServices.Core.DataAccess.DbHelper.ExecuteXmlDeserializer[T](String sprocName, Object[] parameterValues)
at Microsoft.MasterDataServices.Core.DataAccess.MdmDataAccess.GetList[T](Int32 userId, MemoryStream searchCriteria, MemoryStream resultOptions)
at Microsoft.MasterDataServices.Core.BusinessLogic.MdmBusinessLogic`3.GetList(MetadataSearchCriteria searchCriteria, MetadataResultOptions resultOptions)
at Microsoft.MasterDataServices.Services.Service.LoadDerivedHierarchies()
at Microsoft.MasterDataServices.Services.Service.MetadataGet(MetadataGetRequest request)System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.
at Microsoft.MasterDataServices.Core.DataAccess.DbHelper.HandleExceptions(Exception ex)
at Microsoft.MasterDataServices.Core.DataAccess.DbHelper.ExecuteXmlDeserializer[T](String sprocName, CloseConnectionBehavior closeBehavior, Object[] parameterValues)
at Microsoft.MasterDataServices.Core.DataAccess.DbHelper.ExecuteXmlDeserializer[T](String sprocName, Object[] parameterValues)
at Microsoft.MasterDataServices.Core.DataAccess.MdmDataAccess.GetList[T](Int32 userId, MemoryStream searchCriteria, MemoryStream resultOptions)
at Microsoft.MasterDataServices.Core.BusinessLogic.MdmBusinessLogic`3.GetList(MetadataSearchCriteria searchCriteria, MetadataResultOptions resultOptions)
at Microsoft.MasterDataServices.Services.Service.LoadDerivedHierarchies()
at Microsoft.MasterDataServices.Services.Service.MetadataGet(MetadataGetRequest request)These are returned as 110001, A general error occurred.
Additional information. My webservice requires basicHttpBinding in order to support the connection from Silverlight. The endpoint has been configured to support windows authentication.
All Replies
-
Thursday, July 21, 2011 9:30 AMModerator
Hi Half
could you post some of .NET code which causes this error please ?
"Invalid attempt to call MetaData when reader is closed."
it's like your code is not executing in the right order.
Regards,
Xavier Averbouch
Microsoft Community Contributor
Avanade , FRANCE
If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful". -
Thursday, July 21, 2011 11:33 AM
The code in itself is not complicated, but my guess is that it relates to time-outs. Today I got the following exception:
Services threw an unhandled exception!
System.InvalidOperationException: Internal connection fatal error.
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.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.MasterDataServices.Core.DataAccess.DbHelper.ExecuteNonQueryHandlingTransportError(SqlCommand sqlCommand)
at Microsoft.MasterDataServices.Core.DataAccess.DbHelper.SetCommandTimeout()
at Microsoft.MasterDataServices.Core.BusinessEntities.RequestContext.InitializeDatabaseContext()
at Microsoft.MasterDataServices.Core.BusinessEntities.RequestContext.InitializeRequestContext(HostContext hostContext)
at Microsoft.MasterDataServices.Services.Service.GetRequestContext(MessageRequest request)
at Microsoft.MasterDataServices.Services.Service.MetadataGet(MetadataGetRequest request)
at SyncInvokeMetadataGet(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)and then
Services threw an unhandled exception!
System.TimeoutException: The service's security session did not receive a 'close' message from the client within the configured timeout (00:00:10).
at System.ServiceModel.Security.SecuritySessionServerSettings.ServerSecuritySimplexSessionChannel.OnClose(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnClose(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
at System.ServiceModel.Dispatcher.MessageRpc.CloseChannel() -
Thursday, July 21, 2011 1:02 PM
is the MDS working properly.
seems like sl wasn't able to connect to the mds
I mean can you use interent explorer to navigate to
the mds and second do you have the correct permission
http://joeydj.com -
Thursday, July 21, 2011 1:04 PMYes, it is working, it a temporary error, it doesn occur every time.
-
Thursday, July 21, 2011 1:55 PMModerator
Hi,
"System.TimeoutException: The service's security session did not receive a 'close' message from the client within the configured timeout (00:00:10)."
you could raise the time out in mdm.tblSystemSettings and in web.config file of MDS WEB APP.
Regards,
Xavier Averbouch
Microsoft Community Contributor
Avanade , FRANCE
If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful". -
Tuesday, June 05, 2012 6:40 AM
Based on what I have read you can only have one DataReader open at a time on a given connection, and it looks like before the first DataReader closes another DataReader is trying to open causing the error.
Supposedly the work around was to set MultipleActiveResultSets = true in the connection string (on the MDS web service side), which I tried but it didn't seem to fix the issue.
It will be interesting to know if anyone else has had this issue with MDS on SQL Server 2008 R2 and if they managed to come up with a work around.
As stated in prior posts, it doesn't occur all the time.

