Session和Thread Affiliation中的STA对象 [英] STA object in Session and Thread Affiliation

查看:71
本文介绍了Session和Thread Affiliation中的STA对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个我无法得到确定答案的问题。


创建STA对象(例如典型的VB6对象)并分配给

ASP会话商店是一件坏事。


这是一件坏事,因为它迫使IIS将会话与
$联系起来b $ b创建STA对象的线程。


这意味着该会话的所有后续请求只能通过

来处理该工作线程并且可以因此导致性能不佳,因为

请求排队以访问他们所关联的线程。


我的问题是:


这个问题现在是否在会议期间一成不变?


从会话中删除STA对象会删除联盟或是/ b $ b IIS / ASP不是那么聪明吗?


谢谢,


Anthony。

解决方案



" Anthony Jones" < An*@yadayadayada.com>在消息中写道

新闻:e6 ************** @ TK2MSFTNGP09.phx.gbl ...

这是一个问题我一直无法得到明确的答案。

创建一个STA对象(比如一个典型的VB6对象)并分配给ASP会话存储是一件坏事。

这是一件坏事,因为它迫使IIS将会话与创建STA对象的线程联系在一起。

这意味着所有后续的对该会话的请求只能由该工作线程处理,因此可能导致其性能不佳,因为
请求排队访问它们所关联的线程。

我的问题是这样的:

现在,这种情感在会议的整个过程中都是一成不变的吗?


肯定

从会话中删除STA对象是否删除了联盟或者IIS / ASP是不是很聪明?


当然。


ISP会话使用解决方法。但是你的VB类需要坚持下去

(这只是一个属性)。并且持久性,需要实现,所以在VB6类中,你需要将属性写入属性包。

在会话中,它们将被写入

红色时,字节数组反之亦然。

ADO记录集等可持续对象,不要求线程或RAM

(使用ISP Session)只有会话持续的资源。

-

兼容的web farm Asp和Asp.Net的会话替换
http://www.nieropwebconsult.nl/asp_session_manager.htm

谢谢,

Anthony。




感谢您的回复。

我不使用会话对象在请求之间存储状态。


我想知道的是页面是否可以在会话中放置对象
对象然后服务器执行一个或多个其他页面可以操纵这个对象
。最后,原始页面会在完成对客户端的响应之前从Session

中删除对象。


请求之间Session什么都没有。但是我非常怀疑

,即使是这个会话的对象的转发分配也会不可避免地使会话成为工作主线。


:(可惜它会很有用。


干杯,


Anthony。




" Anthony Jones" an *@yadayadayada.com>写在消息中

news:u8 ******** ****** @ TK2MSFTNGP15.phx.gbl ...

感谢您的回复。

我不会使用会话对象在请求之间存储状态。

我想知道的是一个页面是否可以在
Session对象中放置一个对象然后服务器执行一个或多个其他可能操纵该对象的页面最后原始页面会在完成对客户端的响应之前从会话中删除对象。

请求之间Session什么都没有。但是我非常怀疑
即使这个对象的会话过度分配也会不可避免地将会话指向工作主题。




除非您的对象被标记为''两者''并且是自由线程的,不会发生



我怀疑Server.Execute执行以下操作。

它分离当前会话

将它附加到目标页面,

执行该页面,

分离

重新挂接当前页面。


所以基本上,即使你的对象标记为

''Apartment'',你的系统也不应该挂起。


在server.execute之后,移除你的对象


''例如

Session.Contents.Remove" myobject"


Here''s a question that I''ve not been able to get a definitive answer to.

Creating an STA object (such as a typical VB6 object) and assigning to the
ASP Session store is a bad thing.

It''s a bad thing because it forces IIS to affiliate the Session with the
Thread on which the STA object is created.

This means all subsequent requests for that session can only be handled by
that worker thread and can therefore result it in poor performance as
requests queue up to access the thread they are affiliated with.

My question(s) is/are this:

Is this affilation now set in stone for the life time of the session?

Does removing the STA object from the session remove the affiliation or is
IIS/ASP just not that clever?

Thanks,

Anthony.

解决方案


"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:e6**************@TK2MSFTNGP09.phx.gbl...

Here''s a question that I''ve not been able to get a definitive answer to.

Creating an STA object (such as a typical VB6 object) and assigning to the
ASP Session store is a bad thing.

It''s a bad thing because it forces IIS to affiliate the Session with the
Thread on which the STA object is created.

This means all subsequent requests for that session can only be handled by
that worker thread and can therefore result it in poor performance as
requests queue up to access the thread they are affiliated with.

My question(s) is/are this:

Is this affilation now set in stone for the life time of the session?
sure
Does removing the STA object from the session remove the affiliation or is
IIS/ASP just not that clever?
Sure.

ISP Session uses a workaround. But your VB class, needs to be persistable
(this is just a property). And persistance, needs to be implemented, so
within the VB6 class, you need to write the properties to a propertybag.
In the session, they will be written to a byte array and vice versa when
red.
Persistable objects like ADO recordsets as well, do not claim threads or RAM
(with ISP Session only) resources as soon as the session is persisted.
--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm
Thanks,

Anthony.




Thanks for the reply.

I don''t use the session object to store state between requests.

What I was wondering is whether a page could place an object in the Session
object then server execute one or more other pages that could maniputlate
this object. Finally the original page would remove the object from Session
before completing it''s response to the client.

Between requests Session contains nothing. However I very much suspected
that even this transistory assignment of an object to the Session would
irrevocably nail the Session to the work thread.

:( pity that it would be useful.

Cheers,

Anthony.



"Anthony Jones" <An*@yadayadayada.com> wrote in message
news:u8**************@TK2MSFTNGP15.phx.gbl...

Thanks for the reply.

I don''t use the session object to store state between requests.

What I was wondering is whether a page could place an object in the
Session
object then server execute one or more other pages that could maniputlate
this object. Finally the original page would remove the object from
Session
before completing it''s response to the client.

Between requests Session contains nothing. However I very much suspected
that even this transistory assignment of an object to the Session would
irrevocably nail the Session to the work thread.



Unless your object is marked as ''Both'' and is free-threaded, that would not
happen.

And I suspect that Server.Execute does the following.
It detaches the current session
Attaches it to the target page,
executes that page,
detaches
reattaches the current page.

So basically, your system should not hang even if your object is marked as
''Apartment''.

After server.execute, remove your object

''for instance
Session.Contents.Remove "myobject"


这篇关于Session和Thread Affiliation中的STA对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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