帮助手册

NC 接收端演示与联调

可运行的接收端演示:接收 POST 后还原为 NcSubmitItem 列表,控制台查看明文,并可解码 fileStream。正式环境请按贵司规范实现服务。

协议说明见 NC 数据对接。

本页目录


获取源码

文件说明
Program.csHttpListener、控制台命令
NcOps.cs反序列化、明文、extract
Models/NcSubmitModels.cs强类型模型
JmNcReceiver.csproj.NET Framework 4.8 工程
NC提交.txt.example机明侧配置样例

编译与运行

msbuild JmNcReceiver.csproj /p:Configuration=Release
bin\Release\JmNcReceiver.exe

默认监听 http://127.0.0.1:1235/。

JmNcReceiver.exe http://127.0.0.1:8089/
JmNcReceiver.exe --fail
参数 / 操作结果
浏览器 GET探活说明
POST JSON 数组落盘 *.json / *.pretty.json / *.txt,返回 200
--fail故意返回 HTTP 500(仍落盘)

对象还原与操作

summary    打印本批摘要
text       再打印明文,并另存 latest-plain.txt
dump       写回 latest-object.json
extract    解码 fileStream 到 Received\extracted\
load [路径] 从已落盘 JSON 再次还原
help / quit

机明侧配置

{机明启动目录}\系统配置模板\NC提交.txt
Enable=true
URL=http://127.0.0.1:1235/
TimeoutSeconds=60
IncludeContent=false
Gzip=false

示例文件:nc-receiver/NC提交.txt.example。


不启动机明时的自测

$body = Get-Content -Raw -Encoding UTF8 samples\sample-nc-submit.json
Invoke-RestMethod -Uri http://127.0.0.1:1235/ -Method Post -Body $body -ContentType "application/json; charset=utf-8"

样例:samples/sample-nc-submit.json。


行为说明

  • 仅供联调学习,不含鉴权与数据库持久化。
  • 监听 localhost 通常无需管理员权限。
  • 正式对接请自行限制来源、使用 HTTPS,并做幂等与入库。

相关页面:接收端源码 · NC 数据对接 · 程序单数据对接