docs/en/guide/wxopen/register.md
The registration process is similar for all Senparc.Weixin SDKs.
First, complete the overall registration code for all Senparc.Weixin SDKs. Add the following code to Program.cs:
Instructions:
builder.Services.AddMemoryCache() Senparc.Weixin supports various caching strategies such as local cache, Redis, Memcached, etc. Local cache is used by default.builder.Services.AddSenparcWeixinServices(builder.Configuration) is used to complete the registration of Senparc.app.UseSenparcWeixin() method is used to configure and enable Senparc.The above code is the same for all Senparc.Weixin descendant modules, only 3 lines of code are needed.
Reference file for this project:
/Program.cs
Insert code into the delegate method in line 17 of the above code to complete the registration of the default public number:
register.RegisterWxOpenAccount(weixinSetting, "[Shengpai Networks Little Helper] applet");
where the value of weixinSetting comes from appsettings.json by default:
"SenparcWeixinSetting": {
"IsDebug": true,
// Applet.
"WxOpenAppId": "#{WxOpenAppId}#",
"WxOpenAppSecret": "#{WxOpenAppSecret}#",
"WxOpenToken": "#{WxOpenToken}#",
"WxOpenEncodingAESKey": "#{WxOpenEncodingAESKey}#"
}
Where WxOpenToken, WxOpenEncodingAESKey, WxOpenAppId and WxOpenAppSecret correspond to the configuration parameters of the WeChat public backend.
Reference document for this project:
/appsettings.json
Configuration is complete.
Tip: The information of auto-registration can be obtained by
Senparc.Weixin.Config.SenparcWeixinSetting.