IIS 中的请求会在单线程上运行吗? [英] Will a request in IIS run on a single thread?

查看:32
本文介绍了IIS 中的请求会在单线程上运行吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个在 IIS 中运行的系统.

We have a system that runs in IIS.

系统应该始终使用相同的文化"运行,但我们不能依赖正确设置的服务器设置.

The system should always run using the same "culture", but we cannot rely on the server settings being set correct.

一种方法是在每次执行 ToString 时指定区域性.

One way to do it is to specify the culture everytime we do a ToString.

但是,我们想知道,是否可以在方法开始时在线程上设置区域性并依赖该方法中的所有代码都在同一线程上运行?

However, we were wondering, is it possible to set the culture on a thread at the begining of a method and rely on all the code in that method being run on the same thread?

推荐答案

你会动态改变文化吗?如果没有,您可以在 web.config 文件中设置文化.

Do you dynamically change the culture? If not, you can set the culture in the web.config file.

<system.web>
  <globalization culture="ja-JP" uiCulture="zh-HK" />
</system.web>

您也可以在页面级别进行设置:

You can also set it at page level:

<%@Page Culture="fr-FR" Language="C#" %>

在线程上:

Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");

但是对于您使用的内容,页面级别或 web.config 级别似乎是最合适的.

But for what you are using, the page-level or web.config level seems like the most appropriate perhaps.

这篇关于IIS 中的请求会在单线程上运行吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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