开发者

why is the threadID the same when i run my app with different browsers simultaneously?

I have a simple application that contains one button to be clicked in order to start logging, and basically I log messages to database. The application is already set up to log me开发者_开发技巧ssages to a database. So, I tried to run my application in my machine but with two different browsers, for example( google chrome and Internet Explorer) at the same time. And i click the button from both browsers, but the strange thing is the threadID is the same for both browsers. However, when I run the application on same browser several times it does give a new threadID each time I execute it. WHY? As I was expecting the threadID to be different when i run the app from different browsers simultaneously since the execution time was different.


The ThreadID has nothing to do with the browser; it has to do with the Thread running the server code. That is to say, the aspnet worker process (or whatever is running the piece of code you're logging from).


The server reuses threads to handle incoming requests (regardless of what browser you're using, what computer you're logging in with, etc.). I could point my browser at your server, and get the same ThreadId's as you're seeing. There's no guarantee (as far as I know) that your code will run on different threads across multiple requests. There's also no guarantee (as far as I know) that your code will run on the same thread across multiple requests.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜