开发者

Do web.config's globalization settings affect non-http requests?

In my ASP.NET applicatio开发者_如何学运维n I set

<system.web><globalization culture="pl-PL" uiCulture="pl-PL" />

to have numbers and dates in this culture.

Surprisingly I noticed that methods invoked from job scheduler (Quartz library) use en-US? Why is that?


web.config globalization is relatively simple - it sets thread locale when request is being processed. you seem to be invoking methods from another non-asp.net thread, using Quartz.NET scheduler. The invoker has to set thread locale before calling your methods, so in your job code, set locale manually, then call methods you need, like so:

Thread.CurrentThread.CurrentCulture = new CultureInfo("pl-PL");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("pl-PL");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜