I'm trying to find out why ASP.NET Development Server is not processing the requests concurrently.
我试图找出为什么ASP.NET Development Server不会同时处理请求。
So I've created a simple aspx page with the following code:
所以我用以下代码创建了一个简单的aspx页面:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
System.Threading.Thread.Sleep(10000)
End Sub
If I open the page two times, the response takes 20 seconds. That means, the server executes requests one by one (not concurrently).
如果我打开页面两次,响应需要20秒。这意味着,服务器逐个(不同时)执行请求。
Following advice provided in this topic, I've added EnableSessionState="false"
to the page, but that doesn't seem to help.
根据本主题中提供的建议,我在页面中添加了EnableSessionState =“false”,但这似乎没有帮助。
Any ideas how to make the requests process concurrently?
有关如何同时处理请求的任何想法?
3 个解决方案
#1
7
The asp.net dev server (cassini) cannot handle multiple threads. So it effectively processes requests one at a time. Turning session off really won't impact this.
asp.net dev服务器(cassini)无法处理多个线程。因此,它可以有效地一次处理一个请求。关闭会话确实不会影响这一点。
It's really just for limited single user testing of a web app.
它实际上仅适用于Web应用程序的有限单用户测试。
I'd recommend you dump cassini and install IIS Express or just go to the full IIS implementation.
我建议您转储cassini并安装IIS Express或只是转到完整的IIS实现。
A little reading: ASP.NET Dev Server (Cassini), IIS Express and multiple threads
一点点阅读:ASP.NET Dev Server(Cassini),IIS Express和多线程
#2
0
IIS on XP doesn't allow that many concurrent connections (I think it's 10). If you're developing in that environment, that may be why you're experiencing that (besides those 2 requests, you have requests for referenced files taking place, plus you may be issuing more requests than you think you are for that particular page).
XP上的IIS不允许那么多并发连接(我认为它是10)。如果您正在该环境中进行开发,那么这可能就是您遇到这种情况的原因(除了这2个请求之外,您还有对引用文件的请求,而且您可能会发出比您认为的特定页面更多的请求) 。
I'm not sure if VS built-in server has similar limitations.
我不确定VS内置服务器是否有类似的限制。
#3
0
If you're using ASP.NET MVC without disabling SessionState (which by default you would be) your requests will be automatially serialized - so if you're checking for race conditions with a random Thread.Sleep()
value then Request B will never complete before Request A even if the time slept for is less.
如果您在不禁用SessionState的情况下使用ASP.NET MVC(默认情况下会这样),您的请求将自动序列化 - 因此,如果您使用随机Thread.Sleep()值检查竞争条件,那么请求B将永远不会在请求A之前完成,即使睡觉时间较短。
ASP.NET MVC and Ajax, concurrent requests?
ASP.NET MVC和Ajax,并发请求?
#1
7
The asp.net dev server (cassini) cannot handle multiple threads. So it effectively processes requests one at a time. Turning session off really won't impact this.
asp.net dev服务器(cassini)无法处理多个线程。因此,它可以有效地一次处理一个请求。关闭会话确实不会影响这一点。
It's really just for limited single user testing of a web app.
它实际上仅适用于Web应用程序的有限单用户测试。
I'd recommend you dump cassini and install IIS Express or just go to the full IIS implementation.
我建议您转储cassini并安装IIS Express或只是转到完整的IIS实现。
A little reading: ASP.NET Dev Server (Cassini), IIS Express and multiple threads
一点点阅读:ASP.NET Dev Server(Cassini),IIS Express和多线程
#2
0
IIS on XP doesn't allow that many concurrent connections (I think it's 10). If you're developing in that environment, that may be why you're experiencing that (besides those 2 requests, you have requests for referenced files taking place, plus you may be issuing more requests than you think you are for that particular page).
XP上的IIS不允许那么多并发连接(我认为它是10)。如果您正在该环境中进行开发,那么这可能就是您遇到这种情况的原因(除了这2个请求之外,您还有对引用文件的请求,而且您可能会发出比您认为的特定页面更多的请求) 。
I'm not sure if VS built-in server has similar limitations.
我不确定VS内置服务器是否有类似的限制。
#3
0
If you're using ASP.NET MVC without disabling SessionState (which by default you would be) your requests will be automatially serialized - so if you're checking for race conditions with a random Thread.Sleep()
value then Request B will never complete before Request A even if the time slept for is less.
如果您在不禁用SessionState的情况下使用ASP.NET MVC(默认情况下会这样),您的请求将自动序列化 - 因此,如果您使用随机Thread.Sleep()值检查竞争条件,那么请求B将永远不会在请求A之前完成,即使睡觉时间较短。
ASP.NET MVC and Ajax, concurrent requests?
ASP.NET MVC和Ajax,并发请求?