CultureAndRegionInfoBuilder注册 [英] CultureAndRegionInfoBuilder registration

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

问题描述

我有一个非常受文化驱动的Web应用程序。我创建了一些自定义区域性并使用

  CultureAndRegionInfoBuilder 


注册后,我需要定期注册还是注册一次就足够了,它们将在计算机上再存储一次。

解决方案

调用 CultureAndRegionInfoBuilder.Register 将当前的CultureAndRegionInfoBuilder对象作为自定义区域性持久保存在本地计算机上,并使该区域性可用于所有应用程序。但是,它需要管理特权。



此外,从MSDN上,


自定义只有在
对该计算机具有管理权限的用户才能在计算机上注册区域性。因此,应用程序
通常不会创建和安装自定义区域性。相反,您可以
使用CultureAndRegionInfoBuilder类来创建专用的
工具,管理员可以使用该工具来创建,安装和注册
自定义区域性。在计算机上注册自定义区域性之后,
可以使用应用程序中的CultureInfo类来创建
自定义区域性的实例,就像创建预定义区域性一样。


这只是意味着您的网站不应创建自定义文化。应用程序池标识很少是admin(建议不要使用)。使用CultureAndRegionInfoBuilder创建一个单独的安装程序/程序/脚本,以创建这些自定义区域性。


I have a web application that is very much driven by culture. I have created some custom cultures and registered them using

CultureAndRegionInfoBuilder

Once registered do I need to register periodically or is it sufficient to register once and they will be in place on the machine for every more.

解决方案

Calling CultureAndRegionInfoBuilder.Register persists the current CultureAndRegionInfoBuilder object as a custom culture on the local computer and makes that culture available to all applications. However it requires administrative privileges.

Also, From MSDN,

A custom culture can be registered on a computer only by a user who has administrative rights on that computer. Consequently, apps typically do not create and install custom cultures. Instead, you can use the CultureAndRegionInfoBuilder class to create a special-purpose tool that an administrator can use to create, install, and register a custom culture. After the custom culture is registered on a computer, you can use the CultureInfo class in your app to create instances of the custom culture just as you would for a predefined culture.

This simply means that your website should not create custom cultures. The application pool identity is rarely admin (and it's recommanded not to be). Create a separate installer/program/script that will create these custom cultures, using CultureAndRegionInfoBuilder.

这篇关于CultureAndRegionInfoBuilder注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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