C# 用于MVC中数据注释的.NET语言包

C# 用于MVC中数据注释的.NET语言包,c#,asp.net-mvc,data-annotations,C#,Asp.net Mvc,Data Annotations,我想更改验证/数据注释引发的错误的语言,我通过向global.asax文件中添加以下方法成功地做到了这一点: protected void Application_BeginRequest(object sender, EventArgs e) { CultureInfo culture = new CultureInfo("it-IT"); Thread.CurrentThread.CurrentCulture = culture; Thread.CurrentThread.

我想更改验证/数据注释引发的错误的语言,我通过向global.asax文件中添加以下方法成功地做到了这一点:

protected void Application_BeginRequest(object sender, EventArgs e)
{
   CultureInfo culture = new CultureInfo("it-IT");
   Thread.CurrentThread.CurrentCulture = culture;
   Thread.CurrentThread.CurrentUICulture = culture;
}
起初,这不会改变任何事情,后来我意识到我必须安装.NET意大利语语言包。
在我这么做之后,它工作正常,问题是该语言只在安装了软件包的PC上工作,而在运行完全相同应用程序的其他PC上不工作。所以我的问题是,如何将语言包导入应用程序

我不确定,但它可能与引用属性有关。我曾经不得不将“Copy Local”更改为true,因为引用文件没有构建到服务器上。我假设您谈论的是默认行为,而不是在使用本地资源进行数据注释时。准确吗?是的,我用的是默认值。但如果这能解决问题,我不介意使用本地资源。如果您希望将语言包添加到Azure Web应用程序中,请投票支持此请求:@bob我支持简易解决方案。。我刚刚为注释添加了自定义消息。。