CngKey.Import on azure [英] CngKey.Import on azure

查看:20
本文介绍了CngKey.Import on 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 后,我遇到了同样的错误.就我而言,在应用服务/应用名称/应用设置中设置 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.Import on azure的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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