Sorry, too cryptic for me. Please elaborate and explain the setup. Please also include more code, if I do not know what object ‘sites’ is I will probably get it wrong if I try to guess.
My guess is there could be a mistake in Site properties. (In Management Client left hand pane you have in the top the ‘site’, right click and pick Properties. In the Site Properties dialog, inspect all URLs.
Or there could be a mistake in Registered services. (In Management Client top bar, Tools → Registered Services.., inspect the addresses. Also click the Network button and inspect the settings.)
In the previous post, you said “Randomly @ line no 5 gives an exception” - this means that you get the error but not always, and the code works fine sometimes.
Can you please check if all the Milestone services work fine and stable when you run the code?
Also, can you please check if there are any exceptions or errors in Milestone logs ([C:\ProgramData\Milestone\XProtect](file:C:/ProgramData/Milestone/XProtect) Management Server)?
1.Set the following property in the start of your code: Configuration.Instance.ConfigurationApiManager.UseRestApiWhenAvailable = false;
This will change the functionality of the SDK to use the configAPI for communication, which doesn’t have this issue. We have no plans of deprecating the config API, but some new features may only work through the REST API. So once the bug has been fixed, I suggest that you remove this line.
After setting the above line, we do not face any issues.