CngKey.Azure上的导入 [英] CngKey.Import on azure

查看:41
本文介绍了CngKey.Azure上的导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

var rawData = Convert.FromBase64String(_signingKey);
var cng = CngKey.Import(rawData, CngKeyBlobFormat.Pkcs8PrivateBlob);

我使用此代码从嵌入的 base64 字符串中提取密钥.当我在本地测试它时,它工作正常,但是当我在azure上发布时,出现以下异常:

I use this code to extract key, from embedded base64 string. It works fine when I test it locally but when I publish on azure I get following exception:

WindowsCryptographicException: The system cannot find the file specified

(再次,我没有从任何文件读取)我需要它与Apple APNs进行推送通知通信,有什么解决方法吗?而且这仅在免费服务计划中发生,如果我切换到基本计划,它就会起作用.

(once again I'm not reading from any file) I need this to communicate with apple apns for push notifications, is there any workaround? And this happens only on free service plan, if I switch to basic plan it's working.

推荐答案

将现有应用程序发布到Azure之后,我遇到了同样的错误.在我的情况下,在App Services/App Name/Application Settings中设置 WEBSITE_LOAD_USER_PROFILE = 1 后,问题得以解决.

I ran into the same error after publishing an existing application to Azure. In my case the problem was solved after I set WEBSITE_LOAD_USER_PROFILE = 1 in App Services / App Name / Application Settings.

这篇关于CngKey.Azure上的导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆