设置为文化VS开发服务器和IIS上的ASP.NET MVC应用程序 [英] Setting Culture for ASP.NET MVC application on VS dev server and IIS
问题描述
的这是更加具体,这个问题更清楚地版本 - 不同DateTimeFormat用于开发和测试环境
在的Application_BeginRequest()在我的ASP.NET MVC项目的global.asax.cs的方法有code:
In the Application_BeginRequest() method of global.asax.cs in my ASP.NET MVC project there is code:
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB");
当我设置控制器动作断点我看到Thread.CurrentThread.CurrentCulture的以下值:
When I set a breakpoint on Controller Action I see the following value of Thread.CurrentThread.CurrentCulture:
- 在VS开发服务器 - EN-GB
- 在IIS - EN-US
问题是 - 在IIS中设置什么负责这一点,我怎么能覆盖它
Question is - What settings in IIS are responsible for this and how can I override it?
推荐答案
好吧,我其实没有查找IIS设置是负责任的,但我在重写它的 Application_ preRequestHandlerExecute(),它终于摸索:
Well, I didn't actually find what IIS setting is responsible, but I've overridden it in Application_PreRequestHandlerExecute() and it finally worked:
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB");
这篇关于设置为文化VS开发服务器和IIS上的ASP.NET MVC应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!