IncludeOptional sites-enabled/*.conf
protected void Application_AcquireRequestState(object sender, EventArgs e)
{
var currentCultureFromCookie = CookieHelper.GetCultureNameFromHttpCookie();
CultureInfo ci = new CultureInfo(currentCultureFromCookie);
ci.DateTimeFormat.DateSeparator = ".";
ci.DateTimeFormat.ShortDatePattern = "dd.MM.yyyy";
ci.DateTimeFormat.LongDatePattern = "dd.MM.yyyy hh:mm:ss";
CultureInfo cc = CultureInfo.CreateSpecificCulture(ci.Name);
cc.DateTimeFormat.DateSeparator = ".";
cc.DateTimeFormat.ShortDatePattern = "dd.MM.yyyy";
cc.DateTimeFormat.LongDatePattern = "dd.MM.yyyy hh:mm:ss";
//Finally setting culture for each request
Thread.CurrentThread.CurrentUICulture = ci;
Thread.CurrentThread.CurrentCulture = cc;
}
<system.web>
<globalization enableClientBasedCulture="true" uiCulture="auto" culture="auto" />
</system.web>
void Main()
{
System.Threading.ThreadPool.QueueUserWorkItem(ThreadWork);
for(int i = 0;i<10; i++)
{
data.Enqueue(new { data = i });
Thread.Sleep(1000);
mre.Set();
}
isFinish = true;
mre.Set();
}
ManualResetEvent mre = new ManualResetEvent(false);
Queue<object> data = new Queue<object>();
bool isFinish = false;
void ThreadWork(object state)
{
while(true)
{
mre.WaitOne();
if (isFinish)
break;
if (data.Count()>0)
{
var item = data.Dequeue();
new Worker(item).Process();
}
}
}
class Worker
{
readonly object _data;
public Worker(object data)
{
this._data = data;
}
public void Process()
{
//Вот тут ваша логика обработки
}
}
#region Стадия чтения.
), чтобы обработка была "мягче".