代码之家  ›  专栏  ›  技术社区  ›  Steve

Azure的单元测试代码

  •  4
  • Steve  · 技术社区  · 14 年前

    我有一个Azure应用程序,最近在应用程序设置上下了很大功夫。我意识到,将几乎所有我需要的设置都放到服务配置中,这是一种显而易见的方法,可以实现任何你甚至可能远程想要动态更改的设置;这意味着web服务URL、smtp主机信息等都在我的服务配置中。

    Why am I getting SEHException when calling RoleEnvironment.GetConfigurationSettingValue("MYKEY")?

    显然,我有几个选择。。。

    3 回复  |  直到 7 年前
        1
  •  2
  •   knightpfhor    14 年前

        2
  •  6
  •   Rob Church    11 年前

    从2012年6月的Azure版本开始,您可以使用 CloudConfigurationManager -它检查.cscfg和.csdef文件(如果可用),否则从app.config或Web.config的appSettings部分读取:

    <configuration>
      <appSettings>
        <add key="Foo" value="Bar" />
      </appSettings>
    </configuration>
    

    CloudConfigurationManager.GetSetting("Foo")
    
        3
  •  2
  •   Blue Clouds    12 年前

    ProcessStartInfo start = new ProcessStartInfo 
    {                                             
        Arguments = "/devstore:start",                                             
        FileName = @"C:\Program Files\Windows Azure Emulator\emulator\csrun.exe"                        
    };
    

    更多信息,这两个链接可能会有所帮助 http://andrewmatthewthompson.blogspot.nl/2011/12/deploying-packages-to-azure-compute.html

    http://www.neovolve.com/post/2012/01/12/Integration-testing-with-Azure-development-storage.aspx