assembly.
While i try to find receive locations within the C# code the below error is thrown.
My code is as below.
private void EnableLocation()
{
Microsoft.BizTalk.ExplorerOM.ReceiveLocationCollection Locations = new ReceiveLocationCollection();
BtsCatalogExplorer btsCatalogExplorer;
btsCatalogExplorer = new BtsCatalogExplorer();
btsCatalogExplorer.ConnectionString = "Data Source=localhost;Initial Catalog=BizTalkMgmtDb;Integrated Security=true";
foreach (ReceivePort RP in btsCatalogExplorer.ReceivePorts)// Assemblies["APP1"] )
{
System.Diagnostics.EventLog.WriteEntry("1", RP.Name);
if (RP != null)
{
System.Diagnostics.EventLog.WriteEntry("2", RP.Name);
if (RP.ReceiveLocations != null)
{
System.Diagnostics.EventLog.WriteEntry("3", "1");
foreach (ReceiveLocation RL in RP.ReceiveLocations)
{
System.Diagnostics.EventLog.WriteEntry("4", "1");
if (RL.Enable == false)
{
RL.Enable = true;
System.Diagnostics.EventLog.WriteEntry("5", RL.Name);
}
btsCatalogExplorer.SaveChanges();
//btsCatalogExplorer.Refresh();
}
}
}
//Console.WriteLine(RP.Name);
}
}
The Enable location is called from timer_Elapsed method form windows service.
Please help.