微信开发 :WeixinPayInfoCollection尚未注册Mch…
2018-06-22 07:43:26来源:未知 阅读 ()
在使用开源项目 SENPARC.WEIXIN SDK 调用微信支付接口的时候出现了WeixinPayInfoCollection尚未注册Mch,这个问题。
最后地解决方案是:
我这个傻逼忘了在全局Global初始化TenPayV3InfoCollection
只要在Global 添加以下代码
//提供微信支付信息
var tenPayV3_MchId = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_MchId"];
var tenPayV3_Key = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_Key"];
var tenPayV3_AppId = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_AppId"];
var tenPayV3_AppSecret = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_AppSecret"];
var tenPayV3_TenpayNotify = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_TenpayNotify"];
var tenPayV3Info = new TenPayV3Info(tenPayV3_AppId, tenPayV3_AppSecret, tenPayV3_MchId, tenPayV3_Key,
tenPayV3_TenpayNotify);
TenPayV3InfoCollection.Register(tenPayV3Info);
代码示例:
private static TenPayV3Info _tenPayV3Info; /// <summary> /// v3 微信 支付模式属性 /// </summary> public static TenPayV3Info TenPayV3Info { get { if (_tenPayV3Info == null) { _tenPayV3Info =TenPayV3InfoCollection.Data[System.Configuration.ConfigurationManager.AppSettings["TenPayV3_MchId"]]; } return _tenPayV3Info; } } protected void Application_Start(object sender, EventArgs e) { RegisterWeixinPay(); } //提供微信支付信息 var tenPayV3_MchId = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_MchId"]; var tenPayV3_Key = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_Key"]; var tenPayV3_AppId = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_AppId"]; var tenPayV3_AppSecret = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_AppSecret"]; var tenPayV3_TenpayNotify = System.Configuration.ConfigurationManager.AppSettings["TenPayV3_TenpayNotify"]; var tenPayV3Info = new TenPayV3Info(tenPayV3_AppId, tenPayV3_AppSecret, tenPayV3_MchId, tenPayV3_Key,tenPayV3_TenpayNotify); TenPayV3InfoCollection.Register(tenPayV3Info);
webconfig 配置
<!-- 微信支付V3 --> <add key="TenPayV3_MchId" value="TenPayV3_MchId"/> <add key="TenPayV3_Key" value="TenPayV3_Key"/> <add key="TenPayV3_AppId" value="TenPayV3_AppId"/> <add key="TenPayV3_AppSecret" value="TenPayV3_AppSecret"/> <add key="TenPayV3_TenpayNotify" value="TenPayV3_TenpayNotify"/>
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- ASP.NET实现进度条效果 2020-03-15
- MVC数据验证详解 2020-03-14
- asp控件和html控件的概念区别 2020-03-09
- .Net MVC网站中配置文件的读写 2020-02-28
- mvc file控件无刷新异步上传操作源码 2020-02-27
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash