|
@@ -44,7 +44,7 @@ namespace IMCS
|
|
|
|
|
|
// 作为长连接进行bean的存储, key使用ip,
|
|
|
Dictionary<string, Server> opcServerMap = new Dictionary<string, Server>();
|
|
|
- Server opcServer = null;
|
|
|
+
|
|
|
public Dictionary<string, Server> deviceList { get; set; } = new Dictionary<string, Server>();
|
|
|
|
|
|
public Form_Main()
|
|
@@ -99,6 +99,7 @@ namespace IMCS
|
|
|
{
|
|
|
RequestBody opcBody = null;
|
|
|
ResponseBody responseBody = new ResponseBody();
|
|
|
+ Server opcServer = null;
|
|
|
try
|
|
|
{
|
|
|
Stream stream = context.Request.InputStream;
|
|
@@ -129,8 +130,8 @@ namespace IMCS
|
|
|
opcServer = DeviceOPCUat.OpcUa_Connection1(opcBody.ServerUrl, opcBody.UserName, opcBody.Password);
|
|
|
}*/
|
|
|
|
|
|
- // 从map中取出opcServer 判断是否存在,以及是否可用
|
|
|
- opcServerMap.TryGetValue(opcBody.ServerUrl, out opcServer);
|
|
|
+ // 从map中取出opcServer 判断是否存在,以及是否可用
|
|
|
+ opcServerMap.TryGetValue(opcBody.ServerUrl, out opcServer);
|
|
|
|
|
|
// 如果key不存在,或者存在单连接不上,则需要重新创建连接
|
|
|
if (!opcServerMap.ContainsKey(opcBody.ServerUrl) || !opcServer.Session.Connected)
|