private void DoGetTopoTreeAsync(Action <PhysicalTopology> callback) { var clet = CreateServiceClient(); { int view = 0; //0:基本数据; 1:设备信息; 2:人员信息; 3:设备信息 + 人员信息 if (topoRoot == null) //第二次进来就不从数据库获取了 { clet.BeginGetPhysicalTopologyTree(view, (ar) => { topoRoot = null; try { LocationServiceClient client = ar.AsyncState as LocationServiceClient; topoRoot = client.EndGetPhysicalTopologyTree(ar); //异步却不是多线程,服务端关闭时这里还是会卡住 client.Close(); //异步方式用完Close } catch (Exception ex) { LogError("CommunicationObject", ex.ToString()); } DoCallBack(callback, topoRoot); if (topoRoot == null) { LogError("GetTopoTree", "topoRoot == null"); } else { Log.Info("GetTopoTree success 1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); } }, clet); //clet.Close(); } else { Log.Info("GetTopoTree success 2!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); } } }