在Windows Azure中注册自定义区域性 [英] Register custom culture in Windows Azure

查看:47
本文介绍了在Windows Azure中注册自定义区域性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为非洲市场开发ASP.NET MVC 4应用程序,并希望使用以下链接

I am currently developing an ASP.NET MVC 4 app for the African market and was hoping to register a custom culture using the steps detailed in the following link http://msdn.microsoft.com/en-gb/library/system.globalization.cultureandregioninfobuilder.register(v=vs.110).aspx. Most of my target countries are not in the pre-installed cultures so it sounds like I need to register these cultures. Problem is, my console app for doing the registration will need admin previlidges to complete the culture registration. I am presuming windows azure does not allow developers admin control of the cloud service environment.

问题:在没有管理员权限的情况下,在Windows Azure中注册自定义区域性的最佳方法是什么?显然,有一种方法可以在Framework 2.0上使用cultureandregioninfobuilder.compile方法执行此操作,但这不是受支持的方法.有更好的解决方案吗?不想只为每种文化维护不同的项目解决方案,这样我就可以支持不同的语言.

Question: What is the best way to register a custom culture in Windows Azure without admin previlidges. Apparently there's a way to do this on Framework 2.0 using the cultureandregioninfobuilder.compile method but this is not a supported method. Is there a better solution? Don't want to have to maintain different project solutions for each culture just so I can support different languages.

谢谢.

推荐答案

您可以创建一个以提升的特权运行的启动任务,还可以在有限的上下文中运行您的应用程序.您的服务配置文件应如下所示:

You could create a startup task that runs with elevated priviledges, and also run your application on a limited context. Your service configuration file should look like this:

 <ServiceDefinition name="MyCloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2012-10.1.8">
  <WebRole name="MyWebRole" vmsize="Small">
    <Runtime executionContext="limited">
    </Runtime>
    <Startup>
      <Task executionContext="elevated" commandLine="scripts\SetupCulture.cmd" taskType="simple">
        <Environment>
          <Variable name="CULTURE">
            <RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/ConfigurationSettings/ConfigurationSetting[@name='Culture']/@value" />
          </Variable>
        </Environment>
      </Task>
    </Startup>
    ...

   </WebRole>
 </ServiceDefinition>

请注意,您可以在服务配置文件中指定所需的区域性.最后,您可以在.cmd文件中使用环境变量"CULTURE"将其用作执行此工作的.NET可执行文件的参数.

Note with this you can specify the desired culture in the service configuration file. Finally you can use the environment variable "CULTURE" in your .cmd file to use it as parameter to a .NET executable doing the job.

这篇关于在Windows Azure中注册自定义区域性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆