jeson_fxd 2 недель назад
Родитель
Сommit
eabb74e8c3

+ 216 - 0
docs/文档6.10/server_battle_SLua问题排查与打包记录.md

@@ -0,0 +1,216 @@
+# server_battle 项目 SLua 问题排查与打包记录
+
+> 整理时间:2026-06-10  
+> 项目路径:`D:\WorkSpace\project\chuanzhanServer\server_battle`
+
+---
+
+## 一、`using SLua` 编译报错
+
+### 现象
+
+`Program.cs` 中 `using SLua;` 无法识别,编译失败。
+
+### 原因
+
+`GameLogic.csproj` 引用了 NuGet 包路径:
+
+```
+..\packages\slua-standalone.1.0.67\lib\net35\slua-standalone.dll
+```
+
+但仓库中 **缺少该 DLL**。虽然存在 `slua-standalone.1.0.67` 目录和 `Packages` 文件夹,但只有 `content`(配置文件、`.so` 等),没有 `lib\net35\slua-standalone.dll`。
+
+另外注意:`Packages`(大写)与 `packages`(小写)是两个不同目录,csproj 引用的是小写 `packages`。
+
+### 解决方案
+
+从 NuGet 下载并解压 `slua-standalone 1.0.67`:
+
+```powershell
+Invoke-WebRequest -Uri "https://www.nuget.org/api/v2/package/slua-standalone/1.0.67" -OutFile "slua-standalone.1.0.67.zip"
+Expand-Archive -Path "slua-standalone.1.0.67.zip" -DestinationPath "packages\slua-standalone.1.0.67"
+```
+
+解压后应存在:
+
+- `packages\slua-standalone.1.0.67\lib\net35\slua-standalone.dll` — C# 绑定(提供 `SLua` 命名空间)
+- `packages\slua-standalone.1.0.67\content\lib\x64\slua.dll` — Windows 原生库
+
+同时将原生库复制到 `GameLogic\lib\x64` 和 `GameLogic\lib\x86`。
+
+### 其他安装方式
+
+**Visual Studio 包管理器控制台:**
+
+```powershell
+Install-Package slua-standalone -Version 1.0.67
+```
+
+**或从同仓库其他项目复制:**
+
+`server\src\server\OpenCards.Server.Battle` 引用 `server\src\library\slua-standalone.dll`(若该路径有文件)。
+
+### 验证结果
+
+MSBuild 编译成功,生成 `GameLogic.exe`。
+
+---
+
+## 二、打包输出到 `_output.battle.server`
+
+### 需求
+
+将当前项目打包,输出到 `_output.battle.server` 目录。
+
+### 项目特点
+
+本项目为 **.NET Framework 4.8 旧式项目**,不能使用 `dotnet publish`,需使用 MSBuild。
+
+### 已做调整
+
+1. **Release 输出路径**:与 Debug 一致,统一到 `_output.battle.server`
+2. **AfterBuild**:自动将 `GameLogic\lib` 复制到输出目录
+3. **打包.bat**:改为使用 MSBuild(原 `dotnet publish` 不适用)
+
+### 打包命令
+
+```bat
+MSBuild server_battle.sln /t:Rebuild /p:Configuration=Release
+```
+
+或直接双击 `打包.bat`。
+
+### 输出目录结构
+
+```
+_output.battle.server\
+  GameLogic.exe
+  GameLogic.exe.config
+  ServerLib.dll
+  Newtonsoft.Json.dll
+  slua-standalone.dll
+  slua.dll                    ← 后续修复新增
+  lib\
+    x64\slua.dll
+    x86\slua.dll
+    x64\slua.so
+    x86\slua.so
+```
+
+### 运行说明
+
+在 `_output.battle.server` 目录下放置 `Config.json`(含 `ip`、`port`、`luaRoot`),再运行 `GameLogic.exe`。
+
+---
+
+## 三、运行时 `DllNotFoundException: 无法加载 DLL "slua"`
+
+### 现象
+
+```
+System.DllNotFoundException: 无法加载 DLL "slua": 找不到指定的模块。
+(异常来自 HRESULT:0x8007007E)
+```
+
+### 原因分析
+
+SLua 内部通过 P/Invoke 加载原生库:
+
+```csharp
+[DllImport("slua", CallingConvention = CallingConvention.Cdecl)]
+```
+
+**Windows 加载规则**:在 `GameLogic.exe` **同目录**、系统目录或 `PATH` 中查找 `slua.dll`,**不会**自动搜索 `lib\x64`、`lib\x86` 子目录。
+
+之前打包结果中 `slua.dll` 只在子目录:
+
+```
+_output.battle.server\
+  GameLogic.exe
+  lib\x64\slua.dll   ← Windows 找不到
+  lib\x86\slua.dll
+```
+
+### 额外问题:位数不匹配
+
+- 原项目为 `AnyCPU`,在部分环境下以 **32 位** 进程运行
+- 若复制 `lib\x64\slua.dll` 到根目录,会报 `BadImageFormatException`
+- 实测复制 `lib\x86\slua.dll` 可正常启动
+
+`slua-standalone.dll.config` 中的 `<dllmap>` **仅 Linux/Mono 有效**,在 Windows .NET Framework 下不起作用。
+
+### 解决方案
+
+修改 `GameLogic.csproj`:
+
+1. **平台改为 x64**,与 `lib\x64\slua.dll` 一致
+2. **构建后自动复制** 对应架构的 `slua.dll` 到 `_output.battle.server\slua.dll`(与 exe 同级)
+
+AfterBuild 逻辑示意:
+
+```xml
+<PropertyGroup>
+  <SluaNativeArch Condition="'$(PlatformTarget)' == 'x86'">x86</SluaNativeArch>
+  <SluaNativeArch Condition="'$(PlatformTarget)' == 'x64'">x64</SluaNativeArch>
+  <SluaNativeArch Condition="'$(SluaNativeArch)' == ''">x64</SluaNativeArch>
+</PropertyGroup>
+<Copy SourceFiles="$(ProjectDir)lib\$(SluaNativeArch)\slua.dll"
+      DestinationFiles="$(OutputPath)slua.dll" />
+```
+
+### 手动临时修复(不重新编译)
+
+```powershell
+# 64 位进程(项目已改为 x64)
+Copy-Item "GameLogic\lib\x64\slua.dll" "_output.battle.server\slua.dll"
+
+# 若进程是 32 位
+Copy-Item "GameLogic\lib\x86\slua.dll" "_output.battle.server\slua.dll"
+```
+
+### 验证结果
+
+重新打包后服务正常启动:
+
+```
+luaRootPath->D:\WorkSpace\project\chuanzhanServer\server\src\data\ClientScript\
+Sever is running at http://127.0.0.1:8088
+```
+
+---
+
+## 四、注意事项汇总
+
+| 项目 | 说明 |
+|------|------|
+| 目标框架 | .NET Framework 3.5+(当前 4.8,满足要求) |
+| NuGet 包路径 | csproj 引用小写 `packages`,勿与 `Packages` 混淆 |
+| Windows 原生库 | `slua.dll` 必须与 `GameLogic.exe` 同目录 |
+| 平台位数 | 建议明确使用 x64,避免 AnyCPU 位数不一致 |
+| Linux 部署 | 需 `slua.so`,设置 `LD_LIBRARY_PATH` 或使用 dllmap 配置 |
+| VC++ 运行库 | 若仍报「找不到模块」,可能需安装 Visual C++ Redistributable |
+| Git 提交 | 建议将 `packages\slua-standalone.1.0.67\lib\` 纳入版本库 |
+
+---
+
+## 五、相关文件路径
+
+| 文件 | 路径 |
+|------|------|
+| 主程序 | `GameLogic\Program.cs` |
+| 项目配置 | `GameLogic\GameLogic.csproj` |
+| SLua 原生库 | `GameLogic\lib\x64\slua.dll`、`GameLogic\lib\x86\slua.dll` |
+| SLua C# 绑定 | `packages\slua-standalone.1.0.67\lib\net35\slua-standalone.dll` |
+| 输出目录 | `_output.battle.server\` |
+| 打包脚本 | `打包.bat` |
+| 项目记录 | `记录\记录.md` |
+
+---
+
+## 六、项目背景(来自记录.md)
+
+- 战斗校验服使用 `slua-standalone`,Linux 版本未充分测试,目前主要跑 Windows
+- SLua 限制:只能基于 .NET Framework 3.5 及以上开发
+- 逻辑服 HTTP 服务基于 .NET Core 5.0,无法启动 SLua 虚拟机
+- 因此战斗服与游戏逻辑服分离,无法整合在一起

+ 302 - 0
docs/文档6.10/战斗错误6.10.md

@@ -0,0 +1,302 @@
+# chuanzhanServer 对话记录
+
+**日期:** 2026-06-10  
+**项目:** chuanzhanServer  
+**整理内容:** 战斗逻辑位置与战斗结算超时问题、本地起服 127.0.0.1 地址无法访问问题
+
+---
+
+## 一、战斗逻辑存放位置与战斗结算报错
+
+### 1.1 问题描述
+
+战斗结束后,GameNode 日志出现如下报错:
+
+```
+ERROR session:111115_1@GameNode1 - A Task Timeout Exception!
+DeepFrozen.RPC.Remote.RpcException : A Task Timeout Exception!
+
+ERROR ConnectorService_1 - Request is : TypeCodec : OpenCards.Core.Protocol.Client.ClientFightResultRequest (217603)
+```
+
+日志时间线示例:
+
+```
+00:06:32  ClientEnterGameRequest Reconnect(玩家重连)
+00:06:32  StartLogicService
+00:06:40  ClientFightResultRequest 超时(约 8 秒)
+00:07:33  ClientFightResultRequest 再次超时(客户端重试)
+```
+
+---
+
+### 1.2 战斗逻辑存放位置
+
+项目采用 **客户端 Lua 跑战斗 + 服务端 C# 结算/校验** 的架构。
+
+#### 客户端战斗核心(Lua)
+
+**主目录:** `server/src/data/ClientScript/battle/`
+
+| 文件/目录 | 作用 |
+|-----------|------|
+| `battle_main.lua` | 战斗入口,按模式创建不同 Battle 实例 |
+| `battle_core.lua` | 战斗核心循环(tick、update、结算) |
+| `mode/battle_stage.lua` | 主线关卡战斗模式 |
+| `entity/`、`skill/`、`buff/`、`ai/` | 实体、技能、Buff、AI |
+| `server.lua` | 服务端无头战斗入口(供战斗服校验用) |
+
+**客户端控制层:**
+
+- `gameControl/battle/battleCtrl.lua` — 战斗流程控制
+- `gameControl/battleResult/battleResultCtrl.lua` — 战斗结束后发起 `ClientFightResultRequest`
+
+#### 服务端战斗结算(C#)
+
+| 文件 | 作用 |
+|------|------|
+| `OpenCards.Server.Logic/Module/FightModules.cs` | 战斗结果处理核心:`HandleClientFightResultRequest` |
+| `OpenCards.Core/Protocol/Client/0x35200.Logic.Fight.cs` | 协议定义 `ClientFightResultRequest` |
+
+#### 独立战斗校验服
+
+| 位置 | 作用 |
+|------|------|
+| `server_battle/GameLogic/BattleServer.cs` | HTTP 战斗服,监听 `/fight/reqstartbattle` |
+| `OpenCards.Server.Battle/BattleServer.cs` | 集成版战斗服(当前 Lua 调用被注释) |
+
+战斗校验 HTTP 地址:
+
+```csharp
+public static string FightPostURL = "http://127.0.0.1:8088/fight/reqstartbattle";
+```
+
+---
+
+### 1.3 报错原因分析
+
+报错性质是 **RPC 超时**,不是战斗 Lua 逻辑本身抛错。
+
+**调用链:**
+
+```
+客户端 → ConnectorService → SessionService → LogicService(FightModule) → 返回响应
+```
+
+**`ClientFightResultRequest` 服务端处理流程(`FightModules.HandleClientFightResultRequest`):**
+
+1. 校验 `FightMod / StageId / RandomUuid` 是否与开战时一致
+2. (可选)HTTP 调用战斗服重跑校验
+3. 触发 `AsyncEventHandleFightResult` 发奖励、更新关卡
+4. 同步 Public / Center / Bill 等服务
+
+#### 最可能的原因
+
+**① 重连与战斗结算并发冲突(高度可疑)**
+
+重连时 `LogicService` 处理 `ClientEnterGameRequest`,其中有同步阻塞:
+
+```csharp
+// LogicService.cs 第 726 行
+Provider.Execute(NotifyModulesClientEnterGameMustDataAsync).Wait();
+```
+
+`LogicService` 为单线程消息队列,`ClientFightResultRequest` 会排在重连逻辑之后,超过 RPC 超时阈值即报 `Task Timeout Exception`。
+
+**② 下游 RPC 服务响应慢或不可用**
+
+战斗胜利后的结算链路会调用:
+
+- `StageRankModule.CheckStageRankInfo` → StageRank 服务
+- `SyncStageInfo` → Public / Center 服务
+- `HandleSvaeBillInfo` → Bill 服务(保存战报)
+
+任一服务卡住都会导致超时。
+
+**③ 主线战斗校验已被关闭**
+
+`FightModules.cs` 中主线 PVE 的 HTTP 战斗校验代码已被注释:
+
+```csharp
+log.Info("==================  关闭战斗校验   ==================");
+// RequestBattleService(battlerinfo, RandomUuid, ResultInfo);
+```
+
+因此超时**不太可能是**战斗服 Lua 跑战斗太慢,更可能是 LogicService 排队或下游 RPC 阻塞。
+
+**④ RandomUuid 不匹配(会快速失败,不会超时)**
+
+若 `RandomUuid` 与开战时不一致,会直接返回 `CODE_CAN_NOT_FIGHT_CHAPTER`,不会等到超时。
+
+**⑤ ArenaPinnacle 警告无关**
+
+日志中 `Region 1 round contestants is not 8, grouping contestants failed!` 是竞技场巅峰赛分组问题,与本次战斗结算无直接关系。
+
+---
+
+### 1.4 排查建议
+
+1. 查 GameNode1 完整日志,搜索 `111115` + `HandleClientFightResultRequest` / `Enter Game`,看重连与战斗结算是否重叠。
+2. 检查下游服务是否正常:StageRankService、PublicService、CenterService、BillService。
+3. 确认 RPC 超时配置(`_launch_server.xml` 中 `DefaultTaskExecuteTimeout`,默认 60000ms)。
+4. 客户端侧:战斗结束后若网络断开又重连,可在重连成功后再提交战斗结果。
+5. 检查 `_launch_server.xml` 中 `DefaultTaskExecuteTimeout` 是否被改得过短(如 5000–8000ms)。
+
+---
+
+## 二、本地起服后 127.0.0.1 地址无法访问
+
+### 2.1 问题描述
+
+使用 `_launch_server_local.xml` 起服后,配置中的 `127.0.0.1` 相关网址仍无法访问。
+
+**配置文件路径:** `server/src/server/OpenCards.Server.Main/_launch_server_local.xml`
+
+---
+
+### 2.2 两类 127.0.0.1 地址(关键)
+
+配置里的地址分两类,很多**不是**游戏服自己提供的页面。
+
+#### 类型 A:静态配置文件 URL(游戏服不会提供)
+
+```xml
+<ServerListUrl>http://127.0.0.1:8000/serverlist.json</ServerListUrl>
+<StopServerDataURL>http://127.0.0.1/cjw_60000_stop_server.json</StopServerDataURL>
+<UpdateServerConfig>http://127.0.0.1/update_server_config.json</UpdateServerConfig>
+<AndroidClientVersionRecordConfig>http://127.0.0.1/android_version_record_file.json</AndroidClientVersionRecordConfig>
+<!-- 以及 ios 相关配置 -->
+```
+
+这些是 **AccountServer 启动后主动去拉取的配置**,需要本地另起静态 HTTP 服务,游戏服本身不托管这些 JSON。
+
+| URL | 需要的本地服务 |
+|-----|----------------|
+| `http://127.0.0.1:8000/serverlist.json` | 8000 端口静态文件服务 |
+| `http://127.0.0.1/xxx.json`(无端口 = 80) | 80 端口静态文件服务 |
+
+仓库里虽有 `apollo_60000/serverlist.json` 等文件,但:
+
+- 文件名与配置不一致(如 `stop_server_list.json` vs `cjw_60000_stop_server.json`)
+- 没有自动部署到 8000/80 端口的机制
+- `serverlist.json` 里的 `address` 多为远程 IP,本地需改成 `127.0.0.1:19821`
+
+#### 类型 B:游戏服自身 HTTP/TCP 服务
+
+| 服务 | 地址 | 说明 |
+|------|------|------|
+| AccountServer | `http://127.0.0.1:18081/account/` | 账号/区服 API |
+| PayServer | `http://127.0.0.1:18082/pay/` | 支付 |
+| AdminService | `http://127.0.0.1:18088/api/` | 管理后台 |
+| Connector | `127.0.0.1:19821` | 客户端 TCP 连接 |
+
+由 `ServiceLauncher`(`OpenCards.Server.Main` 单节点模式)拉起。
+
+---
+
+### 2.3 当时环境检查结果
+
+本机端口检查:**只有 Redis 6379 在监听**,18081、18082、18088、19821、8000 均未监听。
+
+说明游戏服 HTTP 未成功启动,或进程已退出;仅“执行了起服命令”不够,需确认进程在跑且端口已绑定。
+
+---
+
+### 2.4 常见原因与处理
+
+| 原因 | 说明 | 处理 |
+|------|------|------|
+| 误把配置拉取地址当可访问页面 | `8000/serverlist.json` 需独立静态服 | 在 JSON 目录执行 `python -m http.server 8000` |
+| 本地缺少配置文件 | `cjw_60000_stop_server.json` 等不存在 | 从 `apollo_60000/` 复制重命名,或改 XML URL |
+| serverlist 地址不是本机 | 仓库内多为远程 IP | 改为 `"address": "127.0.0.1:19821"` |
+| Windows URL ACL 未注册 | `http://+:18081` 等需管理员权限 | 以管理员运行,或手动 `netsh http add urlacl` |
+| 依赖未就绪 | Redis、MySQL、战斗服 | Redis 已运行;Pay 需 MySQL;8088 战斗服在 local 配置中被注释 |
+| 启动方式与配置不匹配 | local.xml 仅 GlobalConfig | Main 用 `OpenCards.Server.Main.exe local`;多节点用 DotNetCore + local2 |
+
+**本地 serverlist.json 示例:**
+
+```json
+[
+  {
+    "id": 1,
+    "index": 0,
+    "name": "本地1区",
+    "address": "127.0.0.1:19821",
+    "state": 1,
+    "is_open": true,
+    "capacity": 2000,
+    "serverid": 1,
+    "groupid": 1,
+    "note": "local"
+  }
+]
+```
+
+**Windows URL ACL 手动注册:**
+
+```powershell
+netsh http add urlacl url=http://+:18081/account/ user=Everyone
+netsh http add urlacl url=http://+:18082/pay/ user=Everyone
+netsh http add urlacl url=http://+:18088/api/ user=Everyone
+netsh http add urlacl url=http://+:18089/chat/ user=Everyone
+```
+
+**Main 单节点启动:**
+
+```powershell
+cd server\src\_output.server\net5.0
+OpenCards.Server.Main.exe local
+```
+
+**验证端口:**
+
+```powershell
+netstat -ano | findstr "18081 19821 8000"
+```
+
+**快速改法(不想搭静态服):**
+
+将 `_launch_server_local.xml` 中的 `ServerListUrl` 等改为 OSS 地址(参考 `_launch_server_dev.xml`),本地联调时把 serverlist 中的 `address` 改成本机 IP:19821。
+
+---
+
+### 2.5 推荐本地调试步骤
+
+1. **以管理员身份**启动 Redis(已有)和 MySQL(Pay 需要)。
+2. 准备静态 JSON,启动 8000 端口 HTTP 服务。
+3. 确认 `serverlist.json` 中 `address` 为 `127.0.0.1:19821`。
+4. 以管理员身份启动 `OpenCards.Server.Main.exe local`。
+5. `netstat` 确认 18081、19821、8000 端口监听。
+6. 验证:
+   - 静态配置:`http://127.0.0.1:8000/serverlist.json`
+   - 账号服:`http://127.0.0.1:18081/account/getserverlist`
+
+---
+
+## 三、关键文件索引
+
+| 主题 | 路径 |
+|------|------|
+| 战斗 Lua 核心 | `server/src/data/ClientScript/battle/` |
+| 战斗结算 C# | `server/src/server/OpenCards.Server.Logic/Module/FightModules.cs` |
+| 战斗协议 | `server/src/core/OpenCards.Core/Protocol/Client/0x35200.Logic.Fight.cs` |
+| 战斗校验服 | `server_battle/GameLogic/BattleServer.cs` |
+| 本地起服配置 | `server/src/server/OpenCards.Server.Main/_launch_server_local.xml` |
+| 完整多节点配置 | `server/src/server/OpenCards.Server.Main/_launch_server_local2.xml` |
+| 单节点启动器 | `server/src/server/OpenCards.Server.Main/ServiceLauncher.cs` |
+| 起服入口 | `server/src/server/OpenCards.Server.Main/Program.cs` |
+| 静态配置样例 | `apollo_60000/serverlist.json` 等 |
+
+---
+
+## 四、总结
+
+| 问题 | 结论 |
+|------|------|
+| 战斗逻辑在哪 | 主要在 `server/src/data/ClientScript/battle/`(Lua),结算在 `FightModules.cs` |
+| 战斗结算超时 | RPC 超时;重连阻塞 LogicService 或 StageRank/Center/Bill 下游慢 |
+| 127.0.0.1 无法访问 | 8000/80 为外部静态配置源,需自建 HTTP;18081 等需游戏服成功启动 + 管理员 URL ACL |
+
+---
+
+*文档由 Cursor 对话自动整理生成*

+ 5 - 2
server/src/server/OpenCards.Server.DotNetCore/OpenCardsNameServer.cs

@@ -20,8 +20,11 @@ namespace OpenCards.Server.DotNetCore
         {
             DoStart(doc);
             consoleCommand = RpcAppFactory.Instance.CreateConsoleCommand(Launcher);
-            this.http = new HttpServer(nameserverHttp, consoleCommand, log);
-            this.http.Start();
+            if (!string.IsNullOrEmpty(nameserverHttp))
+            {
+                this.http = new HttpServer(nameserverHttp, consoleCommand, log);
+                this.http.Start();
+            }
         }
 
         protected override bool DoStart(XmlDocument doc)

+ 42 - 0
server/src/server/OpenCards.Server.DotNetCore/OpenCardsRpcAppFactory.cs

@@ -26,6 +26,38 @@ using ServiceProxyInfo = DeepFrozenIceImpl.ServiceProxyInfo;
 
 namespace OpenCards.Server.DotNetCore
 {
+    internal static class OpenCardsConsoleTryReadLine
+    {
+        public static bool TryReadLine(TextReader input, out string cmd)
+        {
+            cmd = null;
+            try
+            {
+                if (Console.IsInputRedirected)
+                {
+                    if (input.Peek() >= 0)
+                    {
+                        cmd = input.ReadLine();
+                        return cmd != null;
+                    }
+                    return false;
+                }
+
+                if (Console.KeyAvailable)
+                {
+                    cmd = input.ReadLine();
+                    return true;
+                }
+            }
+            catch (IOException e)
+            {
+                Console.WriteLine($"TryReadLine报错 :{e}");
+            }
+
+            return false;
+        }
+    }
+
     public class OpenCardsRpcAppFactory : IceRpcAppFactory
     {
         class OpencardIceRpcNameServer : IceRpcNameServer
@@ -227,6 +259,11 @@ namespace OpenCards.Server.DotNetCore
         public OpenCardsNameServerConsoleCommand(NameServerLauncher app) : base(app)
         {
         }
+
+        protected override bool TryReadLine(TextReader input, out string cmd)
+        {
+            return OpenCardsConsoleTryReadLine.TryReadLine(input, out cmd);
+        }
         // 重新加载服务配置
         [Desc("Reload Service Config")]
         public class CMD_RELOADXML : AbstractCommand
@@ -497,6 +534,11 @@ namespace OpenCards.Server.DotNetCore
             //this.OutputDir = new DirectoryInfo($"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}state");
         }
 
+        protected override bool TryReadLine(TextReader input, out string cmd)
+        {
+            return OpenCardsConsoleTryReadLine.TryReadLine(input, out cmd);
+        }
+
         // 重新加载服务配置
         [Desc("Reload Service Config")]
         public class CMD_RELOADXML : AbstractCommand

+ 2 - 11
server/src/server/OpenCards.Server.DotNetCore/Program.cs

@@ -130,20 +130,11 @@ namespace OpenCards.Server.DotNetCore
             LoggerFactory.SetFactory(new BILogger.BICustomLoggerFactory());
 
             var svrName = new OpenCardsNameServer(nameserverHttp);
-            if (string.IsNullOrEmpty(nameserverHttp))
-                svrName.MainLoop(doc);
-            else
-                svrName.Start(doc);
-            while(true)
+            svrName.Start(doc);
+            while (true)
             {
-                svrName.Start(doc);
-                while (true)
-                {
-                    Thread.Sleep(1000);
-                }
                 Thread.Sleep(1000);
             }
-            
         }
 
         public static void StartServerNode(XmlDocument doc, string nodeName)