简体   繁体   English

更改ASP.NET中错误消息的语言

[英]Change language of error messages in ASP.NET

I developing ASP.NET application using a Swedish version of Windows XP and Visual studio Professional. 我使用瑞典语版本的Windows XP和Visual Studio Professional开发ASP.NET应用程序。 When ever i get an error aka. 每当我又得到一个错误。 "yellow screen of death" the error message is in swedish, making it a bit hard to search for info about it. “黄色死亡屏幕”错误消息以瑞典语显示,这使得搜索有关它的信息有些困难。

How can i change what language the error messages in ASP.NET uses? 如何更改ASP.NET中的错误消息使用的语言?

I have no language pack installed for the .net framework. 我没有为.net框架安装语言包。 I am however running an english windows xp with a swedish language interface pack on it. 但是,我正在运行带有瑞典语界面包的英文Windows XP。

I also have this in my web.config: 我的web.config中也有这个:

<system.web>
   <globalization uiCulture="en-US" />
</system.web>

In web.config add: 在web.config中添加:

<system.web>
   <globalization uiCulture="en-US" />
</system.web>

or whatever language you prefer (note: uiCulture="en-US" not culture="en-US"). 或您喜欢的任何一种语言(请注意:uiCulture =“ zh-cn”而不是culture =“ en-US”)。

Also you should check that your app is not changing the uiCulture, for example to a user-specific uiCulture in global.asax. 另外,您还应检查您的应用程序是否未更改uiCulture,例如,将其更改为global.asax中的用户特定的uiCulture。

If the error occurs before or during processing the web.config file, this will of course make no difference. 如果在处理web.config文件之前或期间发生错误,那么这当然不会有任何区别。 In this case, you need to change the regional settings of the account under which the ASP.NET app is running. 在这种情况下,您需要更改运行ASP.NET应用程序的帐户的区域设置。

If you are developing with VS2005 or later, you're probably running under the Cassini web server, under the identity of the current user - so just change the current user's settings. 如果您使用VS2005或更高版本进行开发,则可能是在Cassini Web服务器下,以当前用户的身份运行-只需更改当前用户的设置即可。 If you're using IIS, you probably want to change the regional settings of the ASPNET account - you can do this from Regional Settings in the Control Panel by checking the checkbox "Apply to current user and to the default user profile". 如果您使用的是IIS,则可能要更改ASPNET帐户的区域设置-您可以通过选中“适用于当前用户和默认用户配置文件”复选框,从“控制面板”的“区域设置”中进行更改。

I had the same issue recently on IIS version 10 and these steps fixed it. 我最近在IIS 10上遇到了同样的问题,这些步骤已将其修复。

  1. Open IIS Manager 打开IIS管理器
  2. Select the server from the Connections panel 从“连接”面板中选择服务器
  3. Under the "ASP.NET" double click on ".NET Globalization" 在“ ASP.NET”下,双击“ .NET全球化”
  4. Edit " UI Culture " property 编辑“ UI文化 ”属性
  5. Optionally set the "File" property to "utf-8" (可选)将“文件”属性设置为“ utf-8”
  6. Finally click "Apply" and restart the server. 最后单击“应用”,然后重新启动服务器。

You can find your error translated into English on finderr.net 您可以在finderr.net上找到翻译成英文的错误

or 要么

The second solution to this problem is to move, delete or rename a file containing translations of exceptions. 解决此问题的第二种方法是移动,删除或重命名包含异常翻译的文件。 These translations are in file: 这些翻译在文件中:

%windir%\\assembly\\mscorlib.resources.dll { version: 2.0.0.0 culture: sv token: b77a5c561934e089} %windir%\\ assembly \\ mscorlib.resources.dll {版本:2.0.0.0文化:sv令牌:b77a5c561934e089}

After the change you have to restart .NET framework. 更改后,您必须重新启动.NET Framework。 Important information: Do it on your own risk and I do not know what are the side effects to this solution. 重要信息:自行承担风险,我不知道此解决方案有何副作用。

I had this problem aswell. 我也有这个问题。 I had given up, untill I today gave it another try, that worked; 我放弃了,直到今天我再试一次,才奏效。

Open CMD as administrator, and then type " LPKSETUP " and hit enter, and then uninstall the language that is causing the issue. 以管理员身份打开CMD ,然后键入“ LPKSETUP ”并按Enter,然后卸载引起问题的语言。

All credit goes to spunk.funk ( source ) 所有功劳归于spunk.funk来源

This worked for me. 这对我有用。 And it seems that the timezone and localized keyboard still works, which is the only localized things I want. 似乎时区和本地化键盘仍然有效,这是我想要的唯一本地化的东西。

Aren't the error messages dependent on the installed .NET Framework? 错误消息不取决于已安装的.NET Framework吗? Ie you could just uninstall the Swedish language pack for .NET. 即,您可以只卸载.NET的瑞典语语言包。 On the production server, you'll most likely have an English-only Framework anyway. 无论如何,在生产服务器上,您很可能会拥有仅英文框架。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM