|
|
@@ -59,22 +59,25 @@
|
|
|
|
|
|
## 三、C# 客户端 —— 配 IP/端口的地方(operate / front)
|
|
|
|
|
|
+> 🟢 **2026-06-23 配置收敛**:operate 与 control(同机两进程)的共享连接键(urlIp/urlPort/mqttIp/mqttPort/kfkaIP/kfkaPort/outInter)已收敛为**唯一数据源** `tl-shared.config`(在 operate 输出根目录)。operate 与 control 各自 App.config 经 `<appSettings file="(..\)tl-shared.config">` 只读合并 → **换机改这一份即可,两进程同时生效**(不再 operate/control 各改一遍)。详见 `双进程部署指南.md` + `specs/2026-06-23-配置收敛-operate-control连接组单一数据源-design.md`。front 仍独立(另一台机/另一份 App.config)。
|
|
|
+
|
|
|
### ★★ 两个大坑(改前必看)★★
|
|
|
-1. **`#if DEBUG` 会覆盖 App.config**:`AppData.cs` 构造函数里有 `#if DEBUG` 块,**DEBUG 编译时无条件写死**指向外网 `test-gateway.aivfo.com` / `211.149.139.131`,**App.config 完全不生效**。→ 部署给客户/连测试服务器,必须 **Release 编译**。
|
|
|
-2. **`outInter` 内外网开关**:App.config `outInter=1` 时,代码改用硬编码外网地址(忽略 App.config 的 url/mqtt)。→ 连内网中间件必须 **`outInter=0`**。
|
|
|
- - 满足"Release + outInter=0"后,下表 App.config 的键才真正生效。
|
|
|
+1. **`#if DEBUG` 会覆盖配置**:`AppData.cs` 构造函数里有 `#if DEBUG` 块,**DEBUG 编译时无条件写死**指向外网 `test-gateway.aivfo.com` / `211.149.139.131`,**App.config/tl-shared.config 完全不生效**。→ 部署给客户/连测试服务器,必须 **Release 编译**。
|
|
|
+2. **`outInter` 内外网开关**:`outInter=1` 时,代码改用硬编码外网地址(忽略 url/mqtt)。→ 连内网中间件必须 **`outInter=0`**(该键现也在 `tl-shared.config`)。
|
|
|
+ - 满足"Release + outInter=0"后,下表的键才真正生效。
|
|
|
|
|
|
-### operate(`ivf_tl_operate_2.0/ivf_tl_Operate/`)
|
|
|
-App.config(`App.config`)键 → 代码读取处 `AppData.cs:79-82`、Kafka 在 `App.xaml.cs:72`:
|
|
|
+### operate + control(共享:`<operate输出根>/tl-shared.config`)
|
|
|
+operate 与 control **都读这一份**;operate 读取处 `AppData.cs`/`App.xaml.cs`,control 读取处 `control/ivf_tl_Control/AppData.cs`,均经 `ConfigurationManager.AppSettings`(`file=` 合并)。换机改 `tl-shared.config` 一处:
|
|
|
|
|
|
| 键 | 含义 | 当前值 | 换机设为 |
|
|
|
|---|---|---|---|
|
|
|
| `outInter` | 内/外网(0=内网读本表) | 0 | 0 |
|
|
|
| `urlIp` + `urlPort` | **gateway** 地址 | http://127.0.0.1 : 10010 | gateway 所在机(微服务在本机→127.0.0.1) |
|
|
|
| `mqttIp` + `mqttPort` | **MQTT** broker | 192.168.0.108 : 1883 | MQTT 所在机=192.168.0.108 |
|
|
|
-| `kfkaIP` + `kfkaPort` | **Kafka**(oplog 操作日志,M8) | 192.168.0.108 : 9092 | Kafka 所在机=192.168.0.108 |
|
|
|
+| `kfkaIP` + `kfkaPort` | **Kafka**(oplog 操作日志) | 192.168.0.108 : 9092 | Kafka 所在机=192.168.0.108 |
|
|
|
|
|
|
-> 硬编码默认(App.config 缺键/DEBUG 时才用):`AppData.cs:59` BaseUrl、:61 MqttIp;`App.xaml.cs:72` kfkaIP 默认 127.0.0.1。
|
|
|
+> operate/control 各自 App.config 里**不再有**这 7 个键(已迁出);它们只各自保留自己独有的键(operate:userName/passWord/engineerPwd/tlNum/cacheDisk/Language/houseEnabled/autoFocus/controlPort/controlExePath;control:换气/CCD 业务键 + 凭据等)。统一配置 UI(operate「统一配置」页)保存这 7 键时也写进 `tl-shared.config`(经 `AppConfigHelper`→`SharedConfigStore`)。
|
|
|
+> 硬编码默认(配置缺键/DEBUG 时才用):`AppData.cs` BaseUrl/MqttIp;`App.xaml.cs` kfkaIP 默认 127.0.0.1。
|
|
|
|
|
|
### front 中央管理端(`aivfo-front-manament-2.0/ivf_tl_Manage/`)
|
|
|
App.config 键 → 代码读取处 `AppData.cs:83-86`:
|
|
|
@@ -88,8 +91,9 @@ App.config 键 → 代码读取处 `AppData.cs:83-86`:
|
|
|
|
|
|
> ⚠ 订正(2026-06-22 源码核实):front **有** Kafka/oplog 接入 —— `ivf_tl_Manage/App.config` 含 `kfkaIP/kfkaPort`,`App.xaml.cs` 的 `InitOperationLog()`(project=front、topic=`tl-oplog`)启动 Kafka 产消息端,oplog 模块仅 界面点击/HTTP(详见 CLAUDE.md §5.1)。硬编码默认 BaseUrl/MqttIp 在 `AppData.cs:123-125`。
|
|
|
|
|
|
-### control(历史路径 `ivf_tl_control_2.0/ivf_tl_ControlTest/App.config`,合并后已并入 `ivf_tl_operate_2.0/control/`)
|
|
|
-含 `urlIp/kfkaIP/mqttIp`(值 192.168.0.91),但 **control 合并为 operate 单进程后,运行期读 operate 的 App.config,ControlTest 这份失效**(且该工程计划退役,见 01 §5.5)。**换机无需改它。**
|
|
|
+### control(`ivf_tl_operate_2.0/control/ivf_tl_ControlHost/`)
|
|
|
+control 是**独立进程**(部署在 operate 根的 `control\` 子目录),其 `ivf_tl_ControlHost.dll.config` 经 `<appSettings file="..\tl-shared.config">` 读上一级 operate 根的共享文件 → **与 operate 同源、换机无需单独改 control**。control config 里只保留自己独有的键(换气/CCD 业务键 + 凭据等),不含上面 7 个共享连接键。
|
|
|
+> (历史:合并前 `ivf_tl_control_2.0/ivf_tl_ControlTest/App.config` 已退役删除,见交接卡 D3-01。)
|
|
|
|
|
|
---
|
|
|
|
|
|
@@ -97,7 +101,7 @@ App.config 键 → 代码读取处 `AppData.cs:83-86`:
|
|
|
|
|
|
1. [ ] 新服务器装好 6 中间件,记下新 IP 与端口/账号密码(更新本文第一节 + `服务器测试环境.md`)。
|
|
|
2. [ ] Java:改第二节 **8 个 `server.ip`** 为新 IP;如账号密码变,改各档 datasource user/pwd。
|
|
|
-3. [ ] C#:确认 **Release 编译 + `outInter=0`**;按第三节改 operate/front 的 `urlIp/mqttIp/(operate)kfkaIP`。
|
|
|
+3. [ ] C#:确认 **Release 编译 + `outInter=0`**;改 **operate 根的 `tl-shared.config` 一处**(operate+control 共享 urlIp/urlPort/mqttIp/mqttPort/kfkaIP/kfkaPort/outInter);front 另按第三节 front 表改其 App.config。
|
|
|
4. [ ] Redis 若启用:确认 host/密码生效。
|
|
|
5. [ ] 建库 + migration(见 `进度状态.yaml` 部署前置)。
|
|
|
6. [ ] 起服务冒烟:gateway→各微服务注册 Nacos→operate 登录→MQTT 收发→拍图入 FastDFS→操作日志入 operation_log。
|