【发布时间】:2021-12-11 07:56:38
【问题描述】:
我正在关注此页面以使用 C# 使用 azure key vault 加密 blob
但在此代码块中出现错误
StorageCredentials creds = new StorageCredentials(
CloudConfigurationManager.GetSetting("accountName"),
CloudConfigurationManager.GetSetting("accountKey")
);
未处理的异常。 System.Runtime.InteropServices.MarshalDirectiveException:无法封送“参数 #1”:托管/非托管类型组合无效(不支持与 COM 接口指针之间的封送处理)。
app.config
<appSettings>
<add key="accountName" value="myaccount"/>
<add key="accountKey" value="theaccountkey"/>
<add key="clientId" value="theclientid"/>
<add key="clientSecret" value="theclientsecret"/>
<add key="container" value="stuff"/>
</appSettings>
我尝试了下面链接中给出的解决方案,但这些都不起作用
System.argumentnullexception is null using microsoft azure storage
【问题讨论】:
-
@TheGeneral - 我使用该代码是因为它是在 Microsoft azure 官方页面中提供的 - docs.microsoft.com/en-us/azure/storage/blobs/…
标签: c# azure-blob-storage config azure-keyvault