Why would DbContext be disposed during longrunner?
SmartConnector Forum
Schneider Electric support forum about SmartConnector applications for integration of other building management systems (BMS) into EcoStruxure Building Operation.
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send InviteCancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Link copied. Please paste this link to share this article on your social media post.
2018-06-2912:09 AM
Why would DbContext be disposed during longrunner?
A SmartConnector on site is having issues as it isn't updating it's EWS Values. The log is filled with the HTTP Listener receiving XML but then it's unable to update the values due to the Error:
2018-06-20 03:19:26.7367,Error,Processor,<no principal>,Specific Error The operation cannot be completed because the DbContext has been disposed.,
This connector has been running successfully for 6 months and now the log is being filled with this error even after a restart, it's version 2.3.117 of the Framework.
Link copied. Please paste this link to share this article on your social media post.
2018-06-2905:31 AM
All DB access in SmartConnector is based on Entity Framework. EF caches extensively and it is possible for your context to have "stale" data if you keep it open for extended periods of time. Create the DbContext when you need it, read/write as needed, and then dispose of it. That is the recommended usage pattern. This is true even if you are in an ILongRunningProcessor.