gpt4 book ai didi

c# - CloudConfigurationManager.GetSetting 返回 null

转载 作者:IT王子 更新时间:2023-10-29 04:31:58 26 4
gpt4 key购买 nike

以下说明 here我有:

var connectionString = CloudConfigurationManager.GetSetting("StorageConnectionString");

但是connectionStringnull,这是我的app.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<connectionStrings>
<add name="StorageConnectionString"
connectionString="DefaultEndpointsProtocol=https;AccountName=storage;AccountKey=key" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

最佳答案

遇到同样的问题。不要使用连接字符串,而是使用配置->appSettings->添加键,如下所示...

<configuration>
<appSettings>
<add key="StorageConnectionString" value="[ConnectionStringHere]" />
</appSettings>
</configuration>

关于c# - CloudConfigurationManager.GetSetting 返回 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15384186/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com