设置为文化VS开发服务器和IIS上的ASP.NET MVC应用程序 [英] Setting Culture for ASP.NET MVC application on VS dev server and IIS

查看:81
本文介绍了设置为文化VS开发服务器和IIS上的ASP.NET MVC应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是更加具体,这个问题更清楚地版本 - 不同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:


  1. 在VS开发服务器 - EN-GB

  2. 在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屋!

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