我目前正在为非洲市场开发ASP.NET MVC 4应用程序,并希望使用以下链接 msdn.microsoft/zh-CN/library/system.globalization.cultureandregioninfobuilder.register(v = vs.110).aspx .我的大多数目标国家/地区都没有预先安装的文化,因此听起来我需要注册这些文化.问题是,我用于进行注册的控制台应用程序需要管理员权限才能完成区域性注册.我以为Windows Azure不允许开发人员对云服务环境进行管理员控制.
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 msdn.microsoft/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上使用cultureandregioninfobuilderpile方法执行此操作,但这不是受支持的方法.有更好的解决方案吗?不想只为每种文化维护不同的项目解决方案,这样我就可以支持不同的语言.
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 cultureandregioninfobuilderpile 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="schemas.microsoft/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中注册自定义区域性
发布评论