Senparc.WeixinJS-SDK/ Demo .NET
Senparc.Weixin
.NET 3.5 / 4.0 / 4.5 / .NET Standard 2.x / .NET Core 2.x / .NET Core 3.x / .NET 6.0 MVCRazorWebApiConsole.exeBlazorMAUI
Senparc.Weixin SDK .NET SDK .NET
2013 9
Star )
Sample .NET 7.0
V3
[`/Samples/MP/`](/Samples/MP/)
/Samples/
Sample /Samples/All/
Sample
Program.cs builder.Build()
builder.Services.AddSenparcWeixinServices(builder.Configuration);
Startup.cs ConfigureServices()
Program.cs builder.Build()
var registerService = app.UseSenparcWeixin(app.Environment, null, null, register => { },
(register, weixinSetting) =>
{
//
register.RegisterMpAccount(weixinSetting, "");
});
Startup.cs Configure()
await Senparc.Weixin.MP.AdvancedAPIs.CustomApi.SendTextAsync("AppId", "OpenId", "Hello World!");
1. Senparc.Weixin SDK AccessToken AppId AccessToken
2. AppId `Senparc.Weixin.Config.SenparcWeixinSetting` `appsettings.json` 3. Senparc.Weixin.MP.AdvancedAPIs.CustomApi.SendText() 4. API bug
using Senparc.NeuChar.Entities;
using Senparc.Weixin.MP.Entities;
using Senparc.Weixin.MP.Entities.Request;
using Senparc.Weixin.MP.MessageContexts;
using Senparc.Weixin.MP.MessageHandlers;
namespace Senparc.Weixin.Sample.MP
{
/// <summary>
/// MessageHandler
/// MessageHandler
/// </summary>
public partial class CustomMessageHandler : MessageHandler<DefaultMpMessageContext>
{
public CustomMessageHandler(Stream inputStream, PostModel postModel, int maxRecordCount = 0,
bool onlyAllowEncryptMessage = false, IServiceProvider serviceProvider = null)
: base(inputStream, postModel, maxRecordCount, onlyAllowEncryptMessage, null, serviceProvider)
{
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public override IResponseMessageBase DefaultResponseMessage(IRequestMessageBase requestMessage)
{
//ResponseMessageTextNews
var responseMessage = this.CreateResponseMessage<ResponseMessageText>();
responseMessage.Content = $"";
return responseMessage;
}
public override Task<IResponseMessageBase> OnImageRequestAsync(RequestMessageImage requestMessage)
{
//...
}
public override Task<IResponseMessageBase> OnLocationRequestAsync(RequestMessageLocation requestMessage)
{
//...
}
}
}
`` ControllerWebApi
CustomMessageHandler Program.cs MessageHandler
app.UseMessageHandlerForMp("/WeixinAsync",
(stream, postModel, maxRecordCount, serviceProvider)
=> new CustomMessageHandler(stream, postModel, maxRecordCount, false, serviceProvider),
options
=>
{
options.AccountSettingFunc = context => Senparc.Weixin.Config.SenparcWeixinSetting;
});
https://YourDomain/WeixinAsync >> (URL) Token appsettings.json Sample
Controller WebApi
.NET Framework
.NET Framework/.NET Standard 2.0/.NET Core/.NET 6
# | DLL | Nuget | .NET | |
---|---|---|---|---|
1 | Senparc.Weixin.dll |
|
|
|
2 | / JSSDK / |
Senparc.Weixin.MP.dll |
|
|
3 | Senparc.Weixin.WxOpen.dll |
|
|
|
4 | Senparc.Weixin.TenPay.dll |
|
|
|
5 | V3 | Senparc.Weixin.TenPayV3.dll |
|
|
6 | ASP.NET MVC |
Senparc.Weixin.MP.MVC.dll |
|
|
7 | Senparc.Weixin.QY.dll |
|
|
|
9 | Senparc.Weixin.Work.dll |
|
|
|
9 | Senparc.Weixin.Open.dll |
|
|
|
10 | Redis | Senparc.Weixin.Cache. Redis.dll |
|
|
11 | Memcached |
Senparc.Weixin.Cache. Memcached.dll |
|
|
12 | WebSocket |
Senparc.WebSocket.dll |
|
|
.NET Framework 4.6.2 | .NET Standard 2.0 / 2.1 | .NET Core 2.x / 3.x | .NET 5.0 / .NET 6.0 / .NET 7.0 |
1. 2019 5 1 .NET Framework 3.5 4.0 .NET Framework 3.5 + 4.0 [](https://github.com/JeffreySu/WeiXinMPSDK/releases/tag/v16.6.15)
2. 2022 4 3 .NET Framework 4.5 4.6.2 .NET Framework 4.5 [](https://github.com/JeffreySu/WeiXinMPSDK/releases/tag/v16.17.9)
- API dll Nuget
- Senparc.Weixin.Sample.Net6.sln Senparc.Weixin.Sample.Net7.sln
Release
Nuget/src/BuildOutPut/
Senparc.WebSocket | WebSocket |
Senparc.Weixin.Cache | Senparc.Weixin.Cache.Memcached.dll Senparc.Weixin.Cache.Redis.dll |
Senparc.Weixin.AspNet | Senparc.Weixin.AspNet.dll Web |
Senparc.Weixin.MP.MvcExtension | Senparc.Weixin.MP.MvcExtension.dll MVC |
Senparc.Weixin.MP | Senparc.Weixin.MP.dll SDK |
Senparc.Weixin.MP.Middleware | Senparc.Weixin.MP.Middleware.dll |
Senparc.Weixin.Open | Senparc.Weixin.Open.dll SDK |
Senparc.Weixin.TenPay | Senparc.Weixin.TenPay.dll & Senparc.Weixin.TenPayV3.dll V2 V3 |
Senparc.Weixin.Work | Senparc.Weixin.Work.dll SDK |
Senparc.Weixin.Work.Middleware | Senparc.Weixin.Work.Middleware.dll |
Senparc.Weixin.WxOpen | Senparc.Weixin.WxOpen.dll SDK |
Senparc.Weixin.WxOpen.Middleware | Senparc.Weixin.WxOpen.Middleware.dll |
Senparc.Weixin | Senparc.Weixin.[x].dll |
Senparc.Weixin SDK AccessToken ````
Sample .sln
All
SDK | ||
---|---|---|
MP | Nuget | |
TenPayV2 | V1 V2 | Nuget |
TenPayV3 | V3TenPay APIv3 | Nuget |
Work | Nuget | |
WxOpen | Nuget | |
Shared | Sample | |
All | ||
All/console | Console Demo.NET Core | Nuget |
All/net45-mvc | Demo.NET Framework 4.5 + ASP.NET MVC | Nuget |
All/net6-mvc | Demo.NET 6.0 .NET 5.0 .NET Core | |
All/net7-mvc | Demo.NET 7.0 .NET 5.06.0 .NET Core |
5377815480
14588231256
10246860933
12108830388
16860626938
``
130031388522939583493342319110
`43722120926425898825`
`748294225481062302709539061281`
`115531985931318342413615289181996`
Jeffrey Su 2 BookHelper
BookVersion1
.NET
BookHelper | ||
---|---|---|
![]() |
![]() |
![]() |
ForkPull Request
git checkout -b my-new-feature
)git commit -am 'Added some feature'
)git
(git push origin my-new-feature
)git
my-new-feature
Pull Request
Developer
master
.NET Framework 3.5 / 4.0 / 4.5 / 4.6.2 .NET Core 2.0 + 2.1 / .NET 5.0 + 6.0 release
.NET Framework Demo/src/Samples/All/net45-mvc
.NET 7.0 .NET 5.06.0 .NET Core 3.1 Demo/Samples/All/net7-mvc
- Sample
net7-mvc
SampleRelease
Senaprc.Weixin SDK
- .NET 6.0 .NET 5.0 .NET Core 3.1 Demo
/Samples/All/net6-mvc
Nuget Nuget SDK
App Service Microsoft Azure Web .NET Azure
Web FTP FileZilla Server FTP Samples Senparc.Weixin.Sample.Net7Senparc.Weixin.Sample.Net6 Senparc.Weixin.Sample.NetCore3 Azure App Service FTP
| |
|-----------|---------------
| master |
| Developer | 1 Beta master
2 .NET 4.5 / .NET Core / .NET Core 2.0 Pull Request master
| BookVersion1 |
| DotNET-Core_MySQL | .NET Core Pomelo.EntityFrameworkCore.MySql
| NET4.0 | .NET 4.0 2017.NET 4.0 master / Developer
| NET3.5 | .NET 3.5 2015.NET 3.5 master / Developer
| Developer-Senparc.SDK | Senparc
Apache License Version 2.0
Copyright 2022 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions
and limitations under the License.
Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md