Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.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
Configuration Azure角色配置管理_Configuration_Azure_Web Config_App Config - Fatal编程技术网

Configuration Azure角色配置管理

Configuration Azure角色配置管理,configuration,azure,web-config,app-config,Configuration,Azure,Web Config,App Config,我不明白当你别无选择只能在web.config(或app.config)中保存配置设置时,Windows Azure如何让你改变应用程序的配置 例如 项目通常会使用大量使用web.config的第三方库。web.config的使用可能涉及连接字符串、应用程序设置或自定义配置部分。埃尔玛就是一个很好的例子。ELMAH的web.config文件可能如下所示: <configuration> <configSections> <sectionGroup na

我不明白当你别无选择只能在web.config(或app.config)中保存配置设置时,Windows Azure如何让你改变应用程序的配置

例如

项目通常会使用大量使用web.config的第三方库。web.config的使用可能涉及连接字符串、应用程序设置或自定义配置部分。埃尔玛就是一个很好的例子。ELMAH的web.config文件可能如下所示:

<configuration>

  <configSections>
    <sectionGroup name="elmah">
      <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
      <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
    </sectionGroup>
  </configSections>

  <connectionStrings>
    <add
      name="MyElmahDatabase"
      providerName="System.Data.SqlClient"
      connectionString="Server=tcp:myServer.database.windows.net,1433;Database=myDB;User ID=user@myServer;Password=password;Trusted_Connection=False;Encrypt=True;Connection Timeout=30" />
  </connectionStrings>

  <elmah>
    <security allowRemoteAccess="1" />
    <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="MyElmahDatabase" />
  </elmah>

</configuration>
上面的文档链接表明,重新计算散列很简单(无论如何,在Linux上)


有人知道如何重新计算散列吗?

如果您的web.config中有一些项目需要根据构建方式进行更改,那么您可以使用Azure之外的解决方案。你可以用。这些转换与您的构建配置相关,而不是与您的服务配置相关,但是您的服务配置可能与您的构建配置密切相关(…Local.csfg->Debug,…Cloud.csfg->Release)。如果默认构建配置不适合您,只需创建您需要的配置即可


如果您希望在每个服务配置中使用不同的服务定义,则UI不支持该定义,但您可以将
传递到
ComputeHash()
与使用
字节[]
重载相比,得到不同的哈希。我不知道为什么

尝试以下方法:

private static void ComputeHash(HashAlgorithm hashAlgorithm, Stream stream)
{
    BinaryReader reader = new BinaryReader(stream)
    byte[] hash = hashAlgorithm.ComputeHash( reader.ReadBytes( (int)stream.length ) );
    string hashString = BitConverter.ToString(hash);
    Console.WriteLine(hashString.Replace("-", string.Empty));
    Console.WriteLine();
}
这会让你得到你想要的大麻

正如您可能已经发现的,在linux上,您可以使用

openssl dgst -sha256 /path/to/file

您可以对包的任何配置文件使用.cscfg文件。这不起作用-ELMAH(和其他框架)不会查看.cscfg中保存的配置数据。就我所知,azure包唯一可能的配置方法是.cscfg文件。对于像ELMAH这样的框架,您可能需要找到一种变通方法,比如动态更改配置。但我认为有许多azure的Stackoverflow专家可能会提供更好的答案。这也是一个非常有趣和重要的问题。这在技术上可能可行,但我必须开始维护每个环境的构建配置。此列表可能很长(开发、集成、系统测试、UAT、生产),必须构建每个额外的构建配置,这会增加构建时间。我希望有一个调试版本和一个发布版本,并能够将它们部署到任何环境中。无论您使用何种解决方案,如果您想要为每个环境使用不同的web.config,您都必须按照每个环境进行构建,因为web.config是包的一部分。包一经创建就无法更改。我不确定这是否完全正确-在“调试”构建配置下,我可以有“n”个服务配置。默认情况下,这些是“本地”和“云”,如果我可以有“本地”、“云集成”、“云系统测试”、“云UAT”等,并且可以更改这些服务配置的配置文件,那就太好了。我不明白为什么我必须重建整个解决方案来处理额外的配置文件-编译不等于配置。我认为我们可能在讨论不同的目的,所以让我退一步。您的问题是关于web.config设置及其与服务配置的关系。目前还没有,我也不认为这会很快改变。如果您希望有某种外部web.config,比如.cscfg,您可以只创建一个包,并提供一个与Azure不兼容的配置,因为创建包时,包中包含web.config。您不能仅仅打开包并对其进行更改,因为它是经过签名和检查求和的,所以任何更改都会使其无效,因为这很烦人,如果您想要为每个环境使用不同的web.config,则必须针对每个环境进行构建。
private static void ComputeHash(HashAlgorithm hashAlgorithm, Stream stream)
{
    BinaryReader reader = new BinaryReader(stream)
    byte[] hash = hashAlgorithm.ComputeHash( reader.ReadBytes( (int)stream.length ) );
    string hashString = BitConverter.ToString(hash);
    Console.WriteLine(hashString.Replace("-", string.Empty));
    Console.WriteLine();
}
openssl dgst -sha256 /path/to/file