Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net Azure存储sdk v1.3至v2=>;SetConfigurationSettingPublisher_.net_Azure_Azure Storage - Fatal编程技术网

.net Azure存储sdk v1.3至v2=>;SetConfigurationSettingPublisher

.net Azure存储sdk v1.3至v2=>;SetConfigurationSettingPublisher,.net,azure,azure-storage,.net,Azure,Azure Storage,自从“SetConfigurationSettingPublisher”被删除后,您如何在Azure storage v2.0中转换它 CloudStorageAccount.SetConfigurationSettingPublisher( ( configName, configSetter ) => { // Provide the configSetter with the initial value configSetter( RoleEnvironment.GetCo

自从“SetConfigurationSettingPublisher”被删除后,您如何在Azure storage v2.0中转换它

CloudStorageAccount.SetConfigurationSettingPublisher( 
( configName, configSetter ) =>
{
  // Provide the configSetter with the initial value
  configSetter( RoleEnvironment.GetConfigurationSettingValue( configName ) );

  RoleEnvironment.Changed += ( sender, arg ) =>
  {
    if( arg.Changes.OfType<RoleEnvironmentConfigurationSettingChange>( ).Any( (change) => 
        ( change.ConfigurationSettingName == configName ) ) )
    {
      // The corresponding configuration setting has changed, so propagate the value
      if( !configSetter( RoleEnvironment.GetConfigurationSettingValue( configName ) ) )
      {
        // In this case, the change to the storage account credentials in the
        // service configuration is significant enough that the role needs to be
        // recycled in order to use the latest settings (for example, the 
        // endpoint may have changed)
        RoleEnvironment.RequestRecycle();
      }
    }
  };
}
CloudStorageAccount.SetConfigurationSettingPublisher(
(configName,configSetter)=>
{
//向configSetter提供初始值
configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
RoleEnvironment.Changed+=(发送方,参数)=>
{
if(arg.Changes.OfType().Any((change)=>
(change.ConfigurationSettingName==configName)))
{
//相应的配置设置已更改,因此传播该值
如果(!configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)))
{
//在这种情况下,对存储帐户凭据的更改
//服务配置的重要性足以使角色
//回收以使用最新设置(例如
//端点可能已更改)
RoleEnvironment.RequestRecycle();
}
}
};
}
))

感谢

根据:

CloudStorageAccount.SetConfigurationSettingPublisher已被删除。相反,的成员现在是可变的,允许用户通过提供的UpdateKey方法简单地改变与给定客户机关联的StorageCredentials实例,以更简化的方式完成类似的场景

根据应用程序的要求,您可以直接使用
CloudConfigurationManager.GetSetting()
方法,如中所述:

如果需要在角色实例运行时响应配置更改,则可以订阅和中所述的和事件

var someSetting = CloudConfigurationManager.GetSetting(settingKey);