在新的异步线程一直使用这个签名催生,将在ASP.NET会话对象提供给这个新线程?
IAsyncResult的asyncCall = f.BeginInvoke(NULL,F);解决方案
我不知道哪些会话对象你在谈论,但如果你谈论的ASP.NET会话可能无法使用。此外,它是不好的做法,从后台线程访问ASP.NET会话。我建议你传递一个包含所有必要的信息,以这样的背景下胎面的对象,而不是让它拉东西从会话=>使得它不太可重复使用的。
通常情况下,如果此线程的调用者等待其完成会话应提供所有沿但老实说它是坏的设计,我会简单地避开它。
When a new async thread has been spawned using this signature, will the ASP.NET session object be available to the this new thread?
IAsyncResult asyncCall = f.BeginInvoke(null, f);解决方案
I don't know about which session object you are talking about but if you talk about the ASP.NET Session it might not be available. Also it is bad practice to access the ASP.NET Session from background threads. I would recommend you passing an object containing all the necessary information to this background tread instead of having it pull stuff from a session => makes it less reusable.
Normally if the caller of this thread waits for it to complete the session should be available all along but honestly it's bad design and I would simply avoid it.
更多推荐
异步线程和会话
发布评论