SmartConnector Forum
Schneider Electric support forum about SmartConnector applications for integration of other building management systems (BMS) into EcoStruxure Building Operation.
Link copied. Please paste this link to share this article on your social media post.
Hi,
We have a pocessor that starts multiple Tasks.
After a certain time on a get value/container we catch an error. We assume multithread is the problem.
getcontainer() {
...
DataAdapter.ContainerItems.FirstOrDefault(x => x.AlternateId == "dir");
DataAdapter.ValueItems.FirstOrDefault(x => x.AlternateId == "val1");
...
}
2021-03-24 14:12:02.2852,System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.
at System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command)
at System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
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.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
--- End of inner exception stack trace ---
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
at System.Data.Entity.Infrastructure.DbExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
at Mongoose.Ews.Server.Data.EwsServerDataAdapter.AssertIsConnected()
at Mongoose.Ews.Server.Data.EwsServerDataAdapter.get_ContainerItems()
at SE.SunTracking.SmartConnector.Extension.STServiceProcessor.GetContainer(String altId)
at SE.SunTracking.WebService.GetAS_STTask(String asName)
at SE.SunTracking.STTask.GetUserCommand()
at SE.SunTracking.STTask.ASOperation(STService stService),
Do you have an idea?
Thanks
Link copied. Please paste this link to share this article on your social media post.
Hi @2clode ,
I have definitely ran into this issue in the past a few times, and the answer is I believe that SQL doesn't like this (unless configured a certain way, which from my research is not recommended).
What I have done in the past when I ran into this type of issue is to use a C# Queue object. In my tasks that would normally write directly to the DataAdapter, I instead Enqueue an object, and then I have another task that runs with infinite loop, (which of course accepts cancel commands from the Smart Connector framework) that Dequeues objects and writes into the Smart Connector EWS Server using a single instance of the Data Adapter.
Best Regards,
-Jeff
Link copied. Please paste this link to share this article on your social media post.
Hi,
Thank you for the answer but it is difficult to set up.
I thought I would go through the endpoint to get the data, but I encountered a problem.
I have hosted the service processor in ebo, it's OK.
When I want to get a container the response status is 404(ERROR) and when I want to get a value of this same container the response status is 200 (OK)?
Am I missing something?
Best regards
Claude
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Hi @2clode ,
Now I am a bit more confused, but here is what I understand:
1. You have a Smart Connector extension that collects data from a Sun Tracking service and saves it into an EWS Server Hosted in Smart Connector
2. You then are hosting this EWS Server inside of EBO EWS Interface (which makes sense).
3. You are then point a REST Gateway at EBO to try and get the data from your own EWS Server. My question, what is the point of doing this specifically? Are you also pulling other data from EBO using this rest gateway?
It is possible that the reason you are running into this issue issue is because by default EBO filters our other EWS interfaces when connecting to EBO via EWS (to avoid any potential infinite loops). So you would need to change the filter in EBO's EWS server settings to no longer filter out EWS objects.
Best Regards,
-Jeff
Link copied. Please paste this link to share this article on your social media post.
Hi Jeff,
1. Yes
2. yes
3. We want the processor control to be done from EBO.
We also send orders to the blinds.
For filtering can you give me more information?
best regards
claude
Link copied. Please paste this link to share this article on your social media post.
Hi @2clode ,
As far as #3.
EBO can write to the points via programs, I guess I am still unsure why you need the REST Gateway to do this.
In anycase, about the filtering, see below. you will need to edit the highlighted option, and change where it says "webservice.cws.consume.BaseObject" to basically anything that is not a real object type in EBO, such as "notanobjecttype.notanobjecttype".
Best Regards,
-Jeff
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.