fudiwei / DotNetCore.SKIT.FlurlHttpClient.Wechat

可能是全网最完整的 C# 版微信 SDK,封装全部已知的微信 OpenAPI,包含微信公众平台(订阅号+服务号+小程序+小游戏+小商店+视频号)、微信开放平台、微信商户平台(微信支付+微企付)、企业微信、微信广告平台、微信智能对话开放平台等模块,可跨平台。持续随官方更新,欢迎 Star/Fork/PR。QQ 交流群 875580418【满】、930461548【满】、611974621。
https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient
MIT License
1.51k stars 290 forks source link

[BUG] 请一句话描述此缺陷 #59

Closed yongyaoli closed 2 years ago

yongyaoli commented 2 years ago

⚠⚠ 请注意:不符合格式要求的 Issue 可能会被直接关闭。


关于问题的简单描述 失败System.IO.FileLoadException: Could not load file or assembly 'System.Text.Json, Version=6.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 文件名:“System.Text.Json, Version=6.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51” 在 SKIT.FlurlHttpClient.FlurlSystemTextJsonSerializer..ctor() 在 SKIT.FlurlHttpClient.CommonClientBase.<.ctor>b__8_0(ClientFlurlHttpSettings flurlSettings) 在 Flurl.Http.SettingsExtensions.Configure(IFlurlClient client, Action`1 action) 在 SKIT.FlurlHttpClient.Wechat.TenpayV3.WechatTenpayClient..ctor(WechatTenpayClientOptions options) 在 Crowd.buness.Mini.PayV3.PayV(String openid, String orderno, Int32 amount)
在 Crowd.web.Controllers.CashController.Transfer(Int32 id)

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


与问题相关的源代码

请在此粘贴与问题相关的代码,或提供可复现问题的最小化项目(可提供仓库地址或 GitHub Gist)。

注意,请不要以截图形式提供代码。

var manager = new InMemoryCertificateManager();
            var options = new WechatTenpayClientOptions()
            {
                MerchantId = Tool.Mchid(),  //"微信商户号",
                MerchantV3Secret = Tool.WxPayKey(),   //"微信商户 v3 API 密钥",
                MerchantCertificateSerialNumber = Tool.Serial(), //"微信商户证书序列号",
                MerchantCertificatePrivateKey = @"-----BEGIN PRIVATE KEY-----
***
-----END PRIVATE KEY-----",
                PlatformCertificateManager = manager 
            };
            var client = new WechatTenpayClient(options);
            client.Configure(config =>
            {
                JsonSerializerOptions jsonSerializerOptions = FlurlSystemTextJsonSerializer.GetDefaultSerializerOptions();
                jsonSerializerOptions.WriteIndented = true;
                config.JsonSerializer = new FlurlSystemTextJsonSerializer(jsonSerializerOptions);
            });
            List<CreateTransferBatchRequest.Types.TransferDetail> details = new List<CreateTransferBatchRequest.Types.TransferDetail>();
            CreateTransferBatchRequest.Types.TransferDetail transferDetail = new CreateTransferBatchRequest.Types.TransferDetail();
            transferDetail.OutDetailNumber = orderno;
            transferDetail.TransferAmount = amount;
            transferDetail.TransferRemark = "会员分红提现";
            transferDetail.OpenId = openid;
            //transferDetail.UserName = "";
            details.Add(transferDetail);

            //商家转账到零钱
            var req = new CreateTransferBatchRequest()
            {
                AppId = Tool.WxAppID(),
                OutBatchNumber = orderno+"001",
                BatchName = "会员分红提现",
                BatchRemark = "会员分红提现",
                TotalAmount = amount,
                TotalNumber =1 ,
                TransferDetailList = details
            };
            CreateTransferBatchResponse resp = null;
            Task.Run(async () =>
            {
                resp = await client.ExecuteCreateTransferBatchAsync(req);
            }).GetAwaiter().GetResult();
...

异常堆栈或异常原因

System.IO.FileLoadException: Could not load file or assembly 'System.Text.Json, Version=6.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 文件名:“System.Text.Json, Version=6.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51” 在 SKIT.FlurlHttpClient.FlurlSystemTextJsonSerializer..ctor() 在 SKIT.FlurlHttpClient.CommonClientBase.<.ctor>b__8_0(ClientFlurlHttpSettings flurlSettings) 在 Flurl.Http.SettingsExtensions.Configure(IFlurlClient client, Action`1 action) 在 SKIT.FlurlHttpClient.Wechat.TenpayV3.WechatTenpayClient..ctor(WechatTenpayClientOptions options) 在 Crowd.buness.Mini.PayV3.PayV(String openid, String orderno, Int32 amount) 在 Crowd.web.Controllers.CashController.Transfer(Int32 id) WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


发生问题的运行环境

请在此填写以下几项内容:

  1. 操作系统: Windows Server 2012 R2
  2. .NET 版本: .NET Framework 4.6.1
  3. 使用的模块及版本:SKIT.FlurlHttpClient.Wechat.TenpayV3 2.4.0.0
  4. 其他环境信息。

补充说明

请在此填写任何其他可以定位问题的信息。