configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));错误解决方法

1. 参看配置文件中的connection string name是否正确。

2.I can think of two reasons:

2.1 You are using Azure SDK 1.3 and the SetConfigurationSettingPublisher must be called in your Global.asax.cs Application_Start

2.2 You are not setting the Startup project as the *.CloudService one.

如何简化,station还有很多public static ProductLineConfigModel GetConfigModel(List<ConfigDetail> lst,string station) { ProductLineConfigModel res = new ProductLineConfigModel(); for (int i = 0; i < lst.Count; i++) { if (station == EnumStation.全检站.ToString()) { if (lst[i].ConfigName == EnumConfigItem.模组条码开头.ToString()) { if (lst[i].IsCheck == true) res.ConfigStationAllTest.CheckBarcodeStart = true; else res.ConfigStationAllTest.CheckBarcodeStart = false; res.ConfigStationAllTest.BarcodeStart = lst[i].ConfigValue; } if (lst[i].ConfigName == EnumConfigItem.模组条码长度.ToString()) { if (lst[i].IsCheck == true) res.ConfigStationAllTest.CheckBarcodeLength = true; else res.ConfigStationAllTest.CheckBarcodeLength = false; res.ConfigStationAllTest.BarcodeLength = Convert.ToInt32(lst[i].ConfigValue); } if (lst[i].ConfigName == EnumConfigItem.卡控电芯排列站结果.ToString()) { if (lst[i].IsCheck == true) res.ConfigStationAllTest.CheckCellRecord = true; else res.ConfigStationAllTest.CheckCellRecord = false; } if (lst[i].ConfigName == EnumConfigItem.卡控重复条码.ToString()) { if (lst[i].IsCheck == true) res.ConfigStationAllTest.CheckRepeat = true; else res.ConfigStationAllTest.CheckRepeat = false; } if (lst[i].ConfigName == EnumConfigItem.MES卡控编号.ToString()) { if (lst[i].IsCheck == true) { res.ConfigStationAllTest.MESCheck = true; res.ConfigStationAllTest.MESEquipNo = lst[i].ConfigValue; } else res.ConfigStationAllTest.MESCheck = false; } if (lst[i].ConfigName == EnumConfigItem.模块码所属组装工单.ToString()) { if (lst[i].IsCheck == true) res.ConfigStationAllTest.CheckOrder = true; else res.ConfigStationAllTest.CheckOrder = false; } if (lst[i].ConfigName == EnumConfigItem.卡控尺寸.ToString()) { if (lst[i].IsCheck == true) res.ConfigStationAllTest.CheckSize = true; else res.ConfigStationAllTest.CheckSize = false; } if(lst[i].ConfigName==EnumConfigItem.边长上限.ToString()) { res.ConfigStationAllTest.Size1HiLim = Convert.ToInt32(lst[i].ConfigValue); } if (lst[i].ConfigName == EnumConfigItem.边长下限.ToString()) { res.ConfigStationAllTest.Size1LoLim = Convert.ToInt32(lst[i].ConfigValue); } } if (station == EnumStation.客户码置换站.ToString()) { if (lst[i].ConfigName == EnumConfigItem.客户码1开头.ToString()) { if (lst[i].IsCheck == true) res.ConfigChangeCuSN.CheckCuSNStart = true; else res.ConfigChangeCuSN.CheckCuSNStart = false; res.ConfigChangeCuSN.CuSNStart = lst[i].ConfigValue; } if (lst[i].ConfigName == EnumConfigItem.客户码1长度.ToString()) { if (lst[i].IsCheck == true) res.ConfigChangeCuSN.CheckCuSNLength = true; else res.ConfigChangeCuSN.CheckCuSNLength = false; res.ConfigChangeCuSN.CuSNLength =Convert.ToInt32(lst[i].ConfigValue); } if (lst[i].ConfigName == EnumConfigItem.客户码AB类型不同.ToString()) { if (lst[i].IsCheck == true) res.ConfigChangeCuSN.CheckModuleType = true; else res.ConfigChangeCuSN.CheckModuleType = false; } } } return res; }
07-09
string ip = item.Address; int port = item.Port; //检查网络 Ping pingsend = new Ping(); var send = pingsend.Send(ip, 1000); if (send.Status == IPStatus.Success) { ToolsRetCode ret = ToolsRetCode.toolsCloseOK; IApi pToolsApi = new ApiClass(); IToolsUnit toolsUnit = null; ret = pToolsApi.GetToolsUnit(item.ConfigCode, ip, port, ToolsType.PF4000, ref toolsUnit); BaseVariable.pToolsUnit = toolsUnit; BaseVariable.pToolsUnit.AutoConnect = true; if (ret == ToolsRetCode.toolsOk) { // toolsUnit.ConnectedChange += new ToolsUnitProcessBLL().ToolsUnit_ConnectedChange; toolsUnit.PsetChange += new ToolsUnitProcessBLL().ToolsUnit_PsetChange; toolsUnit.ResultChange += new ToolsUnitProcessBLL().ToolsUnit_ResultChange; ret = toolsUnit.Connect(); if (ret == ToolsRetCode.toolsOk) { //判断是否是人工拧紧枪,是人工拧紧枪要锁枪 //反重力力臂的编号为 1/2,人工拧紧是12 if (item.ConfigCode.Equals("12")) { //锁枪 toolsUnit.DisableTool(); } ret = toolsUnit.SubscribePset(); if (ret == ToolsRetCode.toolsOk) { ret = toolsUnit.SubscribeLastResult(); if (ret == ToolsRetCode.toolsOk) { toolsUnit.AutoConnect = true; toolsUnit.AutoSubCycData = true; toolsUnit.AutoSubPset = true; BaseVariable.pToolsUnit = toolsUnit; BaseVariable.pToolsUnit.AutoConnect = true; Publish.SetLogDataPublish(new LogInfoes() { ChineseContent = $"{item.ConfigName} {item.Address}连接成功,订阅拧紧数据成功", EnglishContent = $"{item.ConfigName} {item.Address} connection successful,Subscribe to tighten data successfully", StationCode = item.StationCode, Style = 0 }); } else { Publish.SetLogDataPublish(new LogInfoes() { ChineseContent = $"{item.ConfigName} {item.Address}连接成功,订阅拧紧数据失败", EnglishContent = $"{item.ConfigName} {item.Address} connection successful,Subscribe to tighten data successfully", StationCode = item.StationCode, Style = 2 }); } } else { Publish.SetLogDataPublish(new LogInfoes() { ChineseContent = $"{item.ConfigName} {item.Address}连接成功,订阅拧紧Pset失败", EnglishContent = string.Empty, StationCode = item.StationCode, Style = 2 }); } if (BaseVariable.toolsUnits.ContainsKey(sysConfigJFC)) { BaseVariable.toolsUnits[sysConfigJFC] = toolsUnit; } else { BaseVariable.toolsUnits.Add(sysConfigJFC, toolsUnit); } } else { Publish.SetLogDataPublish(new LogInfoes() { ChineseContent = $"{item.ConfigName} {item.Address}连接失败", EnglishContent = $"{item.ConfigCode} {item.Address}connection failed.", StationCode = item.StationCode, Style = 2 }); } } } else { }将上述代码封装成接口
11-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值