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.
I am currently working on the Weather Extension Smart Connector Tutorial. I was able to successfully download the GitHub sample examples, as advised in the Developer's Guide, but I am receiving multiple errors during testing (Developer's Guide: Step 6.3.6) *See SmartConnectorErrors.png*.
SetupProcessorFixture/ExecuteTest gave me this error:
An error occurred while updating the entries. See the inner exception for details.
An error occurred while updating the entries. See the inner exception for details.
Cannot insert duplicate key row in object 'dbo.EwsServers' with unique index 'UQ_EwsServer_Address'. The duplicate key value is (http://localhost:56731/).
The statement has been terminated.
at System.Data.Entity.Internal.InternalContext.SaveChanges()
at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
at Mongoose.Service.Data.MongooseDbContext.SaveChanges()
at Mongoose.Service.Data.MongooseDbContext.Mongoose.Common.Data.IDataSource<Mongoose.Ews.Server.Data.EwsServer>.Save()
at Mongoose.Ews.Server.Data.EwsServerDataAdapter.ConnectNew(String name, String address, String realm, String username, String password, Boolean autoStart, Boolean allowCookies, String assemblyFile, String className)
at SmartConnector.WeatherExtension.SetupProcessor.CreateEwsServer() in ...
Expected: True
But was: False
And I received this error at UpdateProcessorFixture/ExecuteTest :
Message:
Failed to connect to a valid EwsServerDataAdapter.
Expected: True
But was: False
I believe that I have a configuration issue of some kind, but I don't know where this configuration issue is and how to solve it.
Best,
Lydia
Posted: 2019-11-06 01:55 PM
Link copied. Please paste this link to share this article on your social media post.
This issue has been solved. Posting back here for public education.
The main problem associated with this is that no connection info was set up in SmartConnector.WeatherExtension.Test's App.config file.
When you run the test, it will try to connect to Smart Connector and set up an EWS server; however, it cannot do that if no connection info was set up. You have to go to the install directory for Smart Connector (will probably be C:/Program Files (x86)/Schneider Electric/Smart Connector) and open "Mongoose.Service.exe.config" in a text editor. Locate the <connectionStrings> element and copy the entire contents between the opening XML tag and the closing one </connectionStrings>. Paste that into the App.Config file, and do the same for the encryption key setting (included in the <appsettings> element). Refer to the attached picture.
However, if freshly downloaded from the repo, you will run into more issues after this one because a couple things need to be set up that are not. The next error will have to do with licensing, most likely. You want to disable licensing, so that a valid license file will not be required to run the processor. Simply have this region of code uncommented in the WeatherProcessorBase class:
#region IsLicensed - Override
public override bool IsLicensed => false;
#endregion
After all this, one will run the ExecuteTest (for SetupProcessor) with seemingly no unit test errors, and an EWS server will be created in the SmartConnector portal. However, the server will be stopped and cannot start. Looking into the logs will show an error that "SmartConnector.WeatherExtension.dll does not exist". Because of the custom EWS implementation, a DLL for this extension must be present in the Smart Connector Install directory. Follow these final steps and everything should run without a hitch:
1. Build the "SmartConnector.WeatherExtension" project after you have removed the need for licensing
2. Open Task Manager and Stop SmartConnectorService
3. The DLL produced by your build can be found in SmartConnectorSamples-master\SmartConnector.WeatherExtension\bin\Debug. Copy that dll into the SmartConnector install folder
4. Start the service back up
5. Run your unit tests
Posted: 2019-11-06 01:55 PM
Link copied. Please paste this link to share this article on your social media post.
This issue has been solved. Posting back here for public education.
The main problem associated with this is that no connection info was set up in SmartConnector.WeatherExtension.Test's App.config file.
When you run the test, it will try to connect to Smart Connector and set up an EWS server; however, it cannot do that if no connection info was set up. You have to go to the install directory for Smart Connector (will probably be C:/Program Files (x86)/Schneider Electric/Smart Connector) and open "Mongoose.Service.exe.config" in a text editor. Locate the <connectionStrings> element and copy the entire contents between the opening XML tag and the closing one </connectionStrings>. Paste that into the App.Config file, and do the same for the encryption key setting (included in the <appsettings> element). Refer to the attached picture.
However, if freshly downloaded from the repo, you will run into more issues after this one because a couple things need to be set up that are not. The next error will have to do with licensing, most likely. You want to disable licensing, so that a valid license file will not be required to run the processor. Simply have this region of code uncommented in the WeatherProcessorBase class:
#region IsLicensed - Override
public override bool IsLicensed => false;
#endregion
After all this, one will run the ExecuteTest (for SetupProcessor) with seemingly no unit test errors, and an EWS server will be created in the SmartConnector portal. However, the server will be stopped and cannot start. Looking into the logs will show an error that "SmartConnector.WeatherExtension.dll does not exist". Because of the custom EWS implementation, a DLL for this extension must be present in the Smart Connector Install directory. Follow these final steps and everything should run without a hitch:
1. Build the "SmartConnector.WeatherExtension" project after you have removed the need for licensing
2. Open Task Manager and Stop SmartConnectorService
3. The DLL produced by your build can be found in SmartConnectorSamples-master\SmartConnector.WeatherExtension\bin\Debug. Copy that dll into the SmartConnector install folder
4. Start the service back up
5. Run your unit tests
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.