0

Config.SenparcWeixinSetting.Items["xxx"]得不到值

微信开发 · donet520 · 查看 169 次 · 于 47天前

配置了多个小程序 ,Config.SenparcWeixinSetting.Items["xxx"]得不到值
您尚未登录,请:网站登录 or 微信登录
共收到 3 条回复
0

Senparc 28天前

光这些代码代码应该是对的,除了Items下面的,第一层的都能正确读取吗?
另外看一下appsettings.json 的文件编码是否有问题,你试试看英文。如果可以的话可能是编码不对,中文读出来乱码了。

0

donet520 36天前

版本是.NET 7.0.5,不知道注册的对不对

注册
//启用微信配置(一句代码)
           var registerService = app.UseSenparcWeixin(app.Environment,
               null /* 不为 null 则覆盖 appsettings  中的 SenpacSetting 配置*/,
               null /* 不为 null 则覆盖 appsettings  中的 SenpacWeixinSetting 配置*/,
               register => { /* CO2NET 全局配置 */ },
               (register, weixinSetting) =>
               {
                   //注册小程序信息(可以执行多次,注册多个小程序)
                   register.RegisterWxOpenAccount(weixinSetting, "第一个小程序");
                   register.RegisterWxOpenAccount(weixinSetting.Items["第二个小程序"], "第二个小程序");

                   //注册微信支付(可以执行多次,注册多个微信支付)
                   register.RegisterTenpayApiV3(weixinSetting, "第一个小程序");//记录到同一个 SenparcWeixinSettingItem 对象中
                   register.RegisterTenpayApiV3(weixinSetting.Items["第二个小程序"], "第二个小程序");//记录到同一个 SenparcWeixinSettingItem 对象中
               });


配置
//Senparc.Weixin SDK 设置
 "SenparcWeixinSetting": {
   //以下为 Senparc.Weixin 的 SenparcWeixinSetting 微信配置
   //注意:所有的字符串值都可能被用于字典索引,因此请勿留空字符串(但可以根据需要,删除对应的整条设置)!

   //微信全局
   "IsDebug": true,

   //以下不使用的参数可以删除,key 修改后将会失效

   //小程序
   "WxOpenAppId": "1111111111111111111",
   "WxOpenAppSecret": "1111111111111111111",
   "WxOpenToken": "1111111111111111111",
   "WxOpenEncodingAESKey": "1111111111111111111",

   //微信支付V3
   "TenPayV3_AppId": "1111111111111111111",
   "TenPayV3_AppSecret": "1111111111111111111",
   "TenPayV3_SubAppId": "#{TenPayV3_SubAppId}#",
   "TenPayV3_SubAppSecret": "#{TenPayV3_SubAppSecret}#",
   "TenPayV3_MchId": "1111111111111111111",
   "TenPayV3_SubMchId": "#{TenPayV3_SubMchId}#", //子商户,没有可留空
   "TenPayV3_Key": "#{TenPayV3_Key}#",
   "TenPayV3_TenpayNotify": "#{TenPayV3_TenpayNotify}#", //https://YourDomainName/TenpayApiV3/PayNotifyUrl
   "TenPayV3_PrivateKey": "#{TenPayV3_PrivateKey}#", //(新)证书私钥
   "TenPayV3_SerialNumber": "#{TenPayV3_SerialNumber}#", //(新)证书序列号
   "TenPayV3_ApiV3Key": "#{TenPayV3_APIv3Key}#", //(新)APIv3 密钥

   //以下Items中的内容根据实际情况使用
   //Items 下面可以添加任意多个公众号、小程序、企业微信、微信支付(V2/V3)、开放平台的信息
   "Items": {
     "第二个小程序": {
       //公众号
       "WxOpenAppId": "2222222222222222222222222",
       "WxOpenAppSecret": "2222222222222222222222222",
       "WxOpenToken": "2222222222222222222222222",
       "WxOpenEncodingAESKey": "2222222222222222222222222",

       //微信支付V3(新版),略
       "TenPayV3_AppId": "2222222222222222222222222",
       "TenPayV3_AppSecret": "2222222222222222222222222",
       "TenPayV3_SubAppId": "#{TenPayV3_SubAppId}#",
       "TenPayV3_SubAppSecret": "#{TenPayV3_SubAppSecret}#",
       "TenPayV3_MchId": "2222222222222222222222222",
       "TenPayV3_SubMchId": "#{TenPayV3_SubMchId}#", //子商户,没有可留空
       "TenPayV3_Key": "#{TenPayV3_Key}#",
       "TenPayV3_TenpayNotify": "#{TenPayV3_TenpayNotify}#", //https://YourDomainName/TenpayApiV3/PayNotifyUrl
       "TenPayV3_PrivateKey": "#{TenPayV3_PrivateKey}#", //(新)证书私钥
       "TenPayV3_SerialNumber": "#{TenPayV3_SerialNumber}#", //(新)证书序列号
       "TenPayV3_ApiV3Key": "#{TenPayV3_APIv3Key}#" //(新)APIv3 密钥
     }
   }
 }


获取得时候是空的
var config1 = Config.SenparcWeixinSetting.Items["第一个小程序"];
var config2 = Config.SenparcWeixinSetting.Items["第二个小程序"];
{
"config1": {
"itemKey": "第一个小程序",
"token": null,
"encodingAESKey": null,
"weixinAppId": null,
"weixinAppSecret": null,
"wxOpenAppId": null,
"wxOpenAppSecret": null,
"wxOpenToken": null,
"wxOpenEncodingAESKey": null,
"weixinCorpId": null,
"weixinCorpAgentId": null,
"weixinCorpSecret": null,
"weixinCorpToken": null,
"weixinCorpEncodingAESKey": null,
"weixinPay_PartnerId": null,
"weixinPay_Key": null,
"weixinPay_AppId": null,
"weixinPay_AppKey": null,
"weixinPay_TenpayNotify": null,
"tenPayV3_MchId": "1111111111111111111",
"tenPayV3_SubMchId": "#{TenPayV3_SubMchId}#",
"tenPayV3_Key": "#{TenPayV3_Key}#",
"tenPayV3_CertPath": null,
"tenPayV3_CertSecret": null,
"tenPayV3_AppId": "1111111111111111111",
"tenPayV3_AppSecret": "1111111111111111111",
"tenPayV3_SubAppId": "#{TenPayV3_SubAppId}#",
"tenPayV3_SubAppSecret": "#{TenPayV3_SubAppSecret}#",
"tenPayV3_TenpayNotify": "#{TenPayV3_TenpayNotify}#",
"tenPayV3_PrivateKey": "#{TenPayV3_PrivateKey}#",
"tenPayV3_SerialNumber": "#{TenPayV3_SerialNumber}#",
"tenPayV3_APIv3Key": "#{TenPayV3_APIv3Key}#",
"tenPayV3_WxOpenTenpayNotify": null,
"component_Appid": null,
"component_Secret": null,
"component_Token": null,
"component_EncodingAESKey": null,
"agentUrl": null,
"agentToken": null,
"senparcWechatAgentKey": null
},
"config2": {
"itemKey": "第二个小程序",
"token": null,
"encodingAESKey": null,
"weixinAppId": null,
"weixinAppSecret": null,
"wxOpenAppId": null,
"wxOpenAppSecret": null,
"wxOpenToken": null,
"wxOpenEncodingAESKey": null,
"weixinCorpId": null,
"weixinCorpAgentId": null,
"weixinCorpSecret": null,
"weixinCorpToken": null,
"weixinCorpEncodingAESKey": null,
"weixinPay_PartnerId": null,
"weixinPay_Key": null,
"weixinPay_AppId": null,
"weixinPay_AppKey": null,
"weixinPay_TenpayNotify": null,
"tenPayV3_MchId": null,
"tenPayV3_SubMchId": null,
"tenPayV3_Key": null,
"tenPayV3_CertPath": null,
"tenPayV3_CertSecret": null,
"tenPayV3_AppId": null,
"tenPayV3_AppSecret": null,
"tenPayV3_SubAppId": null,
"tenPayV3_SubAppSecret": null,
"tenPayV3_TenpayNotify": null,
"tenPayV3_PrivateKey": null,
"tenPayV3_SerialNumber": null,
"tenPayV3_APIv3Key": null,
"tenPayV3_WxOpenTenpayNotify": null,
"component_Appid": null,
"component_Secret": null,
"component_Token": null,
"component_EncodingAESKey": null,
"agentUrl": null,
"agentToken": null,
"senparcWechatAgentKey": null
}
}

0

Senparc 36天前

请问您是如何配置的?包括 .NET 版本?


热门话题 更多 >>

tenpayv3 jsapi 报错,这个是怎么回事呢

cn181 8 个回复 • 查看 484 次 • 166天前

EventLog access is not supported on this platform

FunctionWoo 4 个回复 • 查看 841 次 • 148天前

小程序授权

fjl-net 3 个回复 • 查看 2548 次 • 4天前

企微群发消息更新

1995822cxy 3 个回复 • 查看 329 次 • 179天前

提两个需求

wongsimon 3 个回复 • 查看 318 次 • 165天前

Config.SenparcWeixinSetting.Items["xxx"]得不到值

donet520 3 个回复 • 查看 169 次 • 28天前

.netcore7菜单获取问题

wangbin5542 3 个回复 • 查看 65 次 • 1天前

企业微信自建应用后台搭建

wangliangonline 2 个回复 • 查看 148 次 • 36天前

企业微信官方调整了用户和部门部分接口

qw4566540 2 个回复 • 查看 84 次 • 25天前

创建Xncf模块后因引用包不正确,无法通过编译

greystar 2 个回复 • 查看 234 次 • 113天前

AccessTokenContainer.RegisterAsync重复注册问题

nextuntil 1 个回复 • 查看 208 次 • 66天前

源码里没有微信客服相关的代码吗?

maojiayuan 1 个回复 • 查看 211 次 • 66天前

企业微信升级最新包项目启动异常

fan. 1 个回复 • 查看 242 次 • 66天前

企业微信审批模块审批状态推送事件

qq29366365 1 个回复 • 查看 131 次 • 66天前

NCF启动失败

kenton 1 个回复 • 查看 248 次 • 170天前

个人信息
QQ群
  • 1群:300313885 (2000人群 已满)
  • 2群:293958349 (1000人群 已满)
  • 3群(公众号):342319110 Senparc.Weixin.MPSDK 3群
  • 4群:372212092 (500人群 已满)
  • 5群:377815480 (1000人群 已满)
  • 6群:425898825 (1000人群 已满)
  • 7群:482942254 (500人群 已满)
  • 8群:106230270 (500人群 已满)
  • 9群:539061281 (500人群 已满)
  • 10群(分布式缓存):246860933 Senparc.Weixin.Cache SDK 10群
  • 11群:553198593 (500人群 已满)
  • 12群(小程序):108830388 (2000人群 已满)
  • 13群(开放平台):183424136 (500人群 已满)
  • 14群(视频学员):588231256 Senparc.Weixin SDK 14群
  • 15群(综合):289181996 (500人群 已满)
  • 16群(开放平台):860626938 (500人群 已满)
  • 17群(小程序):770615466 [17群 开放平台]SenparcSDK
  • NCF 技术交流群:147054579 SCF 开发交流群
微信开发宝典:《微信开发深度解析》

由 Senparc.Weixin SDK 作者耗时两年完成的微信开发图书《微信开发深度解析:公众号、小程序高效开发秘籍》已经出版!

历经2年精心雕琢,难得的“理论 + 实战案例 + 趟坑经验”总结,
从需求分析、策划,到账号申请、验证,再到全面的 API 及开发工具,
覆盖所有开发微信公众号(含订阅号、服务号和小程序)所需关键技能!

视频教程:《微信公众号+小程序快速开发》

由盛派课堂(盛派旗下独立教育品牌)制作,《微信开发深度解析》作者苏震巍先生主讲的《微信公众号+小程序快速开发》视频课程开课啦!

课程采用“理论+实战”的教学形式,结合部分《微信开发深度解析》内容,独立于书本,包含了更多的操作演示和案例展示,帮助大家从多个维度学习微信开发以及.NET开发过程中的诸多技巧。
课程包含两大部分:
1. 微信开发基础技能
2. 公众号及小程序案例实战
共计60课时,配有番外篇,目前视频已在网易云课堂上线。