[英]Pushsharp 4 - switch between production and Sandbox
I need to switch between production and sandbox when using PushSharp. 使用PushSharp时,我需要在生产和沙箱之间切换。
Below is the line of code that causes me the issue :- 下面是导致我这个问题的代码行:
var config = new ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Sandbox, @"[CERTPATH]","[PASSWORD]");
The certificate path and passwords are stored in the web.config which means i can easily change these setting when deploying to production. 证书路径和密码存储在web.config中,这意味着在部署到生产环境时,我可以轻松更改这些设置。
Its changing the ApnsServerEnviroment i also need to be able to configure :- 它改变ApnsServerEnviroment我也需要能够配置:-
ApnsConfiguration.ApnsServerEnvironment.Sandbox
ApnsConfiguration.ApnsServerEnvironment.Sandbox
In the future i want to implement PushSharp notifications as a service. 将来我想将PushSharp通知实现为服务。 But for now, its simple a class inside an application.
但就目前而言,它只是应用程序内部的一个简单类。
我的评论只不过是一个答案:只需为环境设置应用程序,然后使if子句检查环境设置,然后根据该条件选择沙箱或生产环境。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.