Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

services.AddSenparcWeixinServices报错null #2755

Closed
zhu-xb opened this issue Jan 5, 2023 · 7 comments
Closed

services.AddSenparcWeixinServices报错null #2755

zhu-xb opened this issue Jan 5, 2023 · 7 comments
Labels
resolved 已解决

Comments

@zhu-xb
Copy link

zhu-xb commented Jan 5, 2023

Senparc.Weixin.Work
版本号:3.15.14.1
在Startup.cs中ConfigureServices里使用services.AddSenparcWeixinServices(Configuration),报错NULL未引用。
原因是Senparc.Weixin.RegisterServices.RegisterServiceExtension.AddCertHttpClient 方法中certPath.StartsWith("/")行出错,该方法要求必须在appsetting.json中配置TenPayV3_CertPath,如果未配置, tenPayV3Setting.TenPayV3_CertPath的值就是NULL,然后在执行certPath.StartsWith("/")会报错NULL未引用。

@JeffreySu
Copy link
Owner

实际传入的 certPath 参数是 null 了吗?

@zhu-xb
Copy link
Author

zhu-xb commented Jan 6, 2023

在startup.cs中执行builder.Services.AddSenparcWeixinServices(builder.Configuration);
且appsetting.json中未配置TenPayV3_CertPath节点时
Senparc.Weixin.RegisterServices.RegisterServiceExtension类第90行,tenPayV3Setting.TenPayV3_CertPath的值为null;
在执行到162行if (certPath.StartsWith("~/"))时,由于传入的certPath是null,会报null未引用的错误。

@adaxiong
Copy link
Contributor

adaxiong commented Jan 6, 2023

我也报错了,因为我是用v3,
就直接弄成
services.AddSenparcWeixinServices(configuration,delegate {});
就可以了,不用证书

@JeffreySu
Copy link
Owner

@zhu-xb @adaxiong 新版本已经发布了,你们可以更新试一下。

@visualczm
Copy link

@adaxiong 感谢,我的也是报错空。你这个可以
@JeffreySu nuget最新版本,谢谢

@pipihu
Copy link

pipihu commented Jan 18, 2023

@zhu-xb @adaxiong 新版本已经发布了,你们可以更新试一下。
大佬
TenPayV3_CertPath 这个问题依然存在呢。
是不是 Senparc.Weixin/RegisterServices/SenparcWeixinRegisterServiceExtension.cs 的 AddCertHttpClient 方法也要修改?

@JeffreySu
Copy link
Owner

@pipihu 最新版本你再看一下,1月份应该已经都解决了。

@JeffreySu JeffreySu added the resolved 已解决 label Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolved 已解决
Projects
None yet
Development

No branches or pull requests

5 participants