.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

HttpWorkerRequest - not blocking ReadEntityBody?

Posted By:      Posted Date: October 18, 2010    Points: 0   Category :ASP.Net

In case when there are many connections to the IIS7 that are most of the time idle creating a thread for every connection could be expensive.

Imagine an example 1000 connections (or more) that are sending 100 bytes every 10 seconds for few hours (PUT in chunks). The read process is done like this:

void ReadData(HttpWorkerRequest wr)



while (true)


int chunkBytes = wr.ReadEntityBody(buffer, buffer.Length);

// check for the end of transmission


// process data






Execution of ReadEntityBody is blocking so the thread is going idle while waiting for data. Is any way to avoid this problem? May be it's possible to check if anything is in the buffer before calling the method or it is possible to get a call back when data is ready? Other idea?

Any help would be appreciated.

View Complete Post

More Related Resource Links

IP Address Blocking or Restriction in SQL Server

"is it possible to block connections to SQL Server based on IP address". As far as now there is no official way in SQL Server to block the connections in SQL Server based on IP address. However this can be done from the OS end, we have the following three options available, refer HERE for more.

.RRAS IP Filter

IRequestChannel.Request blocking forever

Hello, I am using netcfsvcutil.exe to generate WCF proxy code on my mobile device (Pocket PC 4.2 running .net CF 3.5) to communicate to my WCF Service. Everything works well until the remote device gets disconnected from the network (for example, the DHCP server goes down and it reverts to an invalid default IP). At this point, any calls to my service will block indefinitely.  This problem does not occur if say the remote service is disabled, rather only if there is some network issue on the client. The source of this problem seems to be the call to requestChannel.Request(msg) in the getReply() method in the CFClientBase class will block forever. I have tried adding a timeout to it to no avail.  I also find it odd that the call to open() doesn't throw an exception and sets the state to open. I am new to WCF and can't get past this problem, any help would be appreciated. Here is the generated method in question:   private System.ServiceModel.Channels.Message getReply(System.ServiceModel.Channels.Message msg) { if ((this.RequestChannelFactory == null)) { // transport doesn't support requests throw new System.NotSupportedException(); } System.ServiceModel.Channels.IRequestChannel requestChannel; System.Threading.Monitor.Enter(this.RequestChannelFactory); try { requestChannel = th

limit ASP.NET User Session without blocking production

 If the Web Site is in production and there are hits from one particular place (Say London!) and the after 1000 (or x) requests, user session should not be allowed. So what to do in such situation without affecting current production site?  Please Advice. Thanks!  

Asynchronous WCF call seems to be blocking

Hi all,I have a Silverlight application that calls a WCF web service which is hosted in an ASP.NET web application. On the client side I call two methods A and B on the service's interface asynchronously; each time a new proxy is created and used to call the respective method. Since the service has its InstanceContextMode set to PerCall, each call should create a new service instance and be independent from the others.For testing purposes I have added a Thread.Sleep(5000) to the implementation of method A.What I expect now is that when the client calls methods A and B one after the other, the service should process both calls in parallel and since method A has the call to Sleep(), method B should return first. Five seconds after that, method A should return as well.For the very first attempt in the web application's lifetime this works as expected, i.e. after rebuilding or performing an iisreset and calling those methods from the client side, it shows the expected behavior explained above. Here's a sample debug dump I received on the client:    Method B, 17:41:23, Server-Thread-ID: 9    Method A, 17:41:28, Server-Thread-ID: 8But after that, when I call those methods again (in exactly the same way), method A seems to block on the server:    Method A, 17:42:43, Server-Thread-ID: 1    Method B, 17:42:44, Serv

Logon Trigger blocking problem

I'm trying to learn how to use microsoft sync framework using the following example, but am having a problem with a logon trigger blocking something.  If I disable the trigger it will work, but that really isn't an option.  Normally, if something is blocked it is placed in a blockedLog table with the name of the user and application.  If we need to allow access then we can put this information in the BlockedExceptions table to allow it through.  Initially, the .Net SqlClient Data Provider gets blocked.  After adding it to the accepts table, I still get a blocking error due to the trigger, but I can't determine what is actually being blocked.  The table never fills with any information about what gets blocked after fixing the initial .Net SqlClient Data Provider error and I have not been able to figure out anything using the profiler or activity monitor. Sync Example in question:http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=3422 CREATE TRIGGER [BlockLogins] ON ALL SERVER WITH EXECUTE AS 'DBTrigger' FOR LOGON AS BEGIN DECLARE @Allow bit SET @Allow = 'TRUE' IF (SELECT COUNT(*) FROM DB.dbo.Programs WHERE AppTitle= APP_NAME()) = 0 BEGIN -- ** Other allowed apps and users are in BlockedExceptions ** -- If it is a non-application that any user is allowed to run then let it through.

DBCC CHECKDB Blocking Itself SQL 2008 MSCRM

Hello I've got a nightly job that runs DBCC CHECKDB WITH TABLERESULTS for all databases, using sp_msforeachdb, and then saves the results into a table, tidies them up, and then disappears off. On my test MSCRM database, the DBCC CHECKDB command is blocking itself. The only way to resolve this self-blocking seems to be to restart SQL. sp_who2 won't execute, but sp_who does. DBCC INPUTBUFFER tells me that it's the stored procedure I'm executing causing the blocking.  A bit more searching into sys.dm_os_waiting_tasks and and sys.dm_exec_connections suggests that this piece of code is causing the problem: DECLARE @BlobEater VARBINARY(8000)   SELECT @BlobEater = CheckIndex (ROWSET_COLUMN_FACT_BLOB)  FROM { IRowset 0xE093909D00000000 }  GROUP BY ROWSET_COLUMN_FACT_KEY  >> WITH ORDER BY    ROWSET_COLUMN_FACT_KEY,    ROWSET_COLUMN_SLOT_ID,    ROWSET_COLUMN_COMBINED_ID,    ROWSET_COLUMN_FACT_BLOB  OPTION (ORDER GROUP)  with a wait_type of LCK_M_IX the resource type is objectlock lockPartition=0 objid=34 subresource=FULL dbid=2 id=lock8defbd80 mode=SIX associatedObjectId=34 Trying to rollback the transaction doesn't help: it just sits in a rollback sort of a state. Trying to stop SQL doesn't work too well: going into Task Manager on the Server and killing the sqlserver.exe pr

SQL Agent job keeps on Blocking

Hi All, I set a job to run every morning, for the first few days it worked fine but from yesterday morning, when I run the query that checks if there are any jobs that are blocks, it showed that the job starts running but stops after a second then blocks it's self. The jobs wait type is CXPACKET. Would someone let me know how I can resolve this please? Thank you    

Processes blocking RESOURCE MONITOR, normal behaviour?

Today I ended up in a situation where I had a process with total six "subthreads" (identified by different execution context) (seen in Activity Monitor). All of these had blocking=1. The server didn't function properly, I don't know the details of these problems, since I was not present at that time. We had to kill the processes. What is the process id 1, "RESOURCE MONITOR" in SQL Server 2005, seen in Activity Monitor? Is it fatal if some processes are blocking RESOURCE MONITOR? How can one end up in such situation, is it normal or a bug somewhere?   The server is a 64-bit Windows server having SQL Server 2005 SP1.   Yesterday I had a CLR stored procedure running on another server. The procedure uses System.Data.SqlClient.SqlConnection to access this server. The procedure started about 11.4.2007 22:22. The procedure created a connection to the SQL Server and created a select that should return 1,5 million rows. During fetching the rows (about after 800 000 rows) the procedure crashes to an error:"".NET Framework execution was aborted by escalation policy because of out of memory. " Naturally the procedure couldn't close the SQL Server connections, since it was forced to end.   The details if the processes as seen from Actívity Monitor (I only have screenshots so I can't copy-paste...):   The main process: Process id: 69 status: suspended o

Blocking javascript:SubmitFormPost() in a Web Part???

I have a link list I'm displaying as a web part on my site's home page. I'm using SharePoint 2010 Server. I have another document library web part as well. The link list has a couple of folders that contain other hyperlinks. Very nice for grouping. Anyways, when a user clicks on the folder in the link list, it uses "javascript:SubmitFormPost()" to refresh and display only the contents of the folder. Meanwhile, it must be passing something to my document library web part because instead of showing the nice top-level view of all the library folders, it shows a bunch of folders with names like "1", "0", "2" and othe stuff from the document library. I'm wondering if I can block the javascript:SubmitFormPost() from affecting my document library web part? Is there something else that would cause this to happen??? Thanks!!

blocking sharepoint installation


im trying to do http://technet.microsoft.com/en-us/library/ff730261.aspx

but i dont see the registry key or folders that they are looking for

am i missing somthing ?




SQL blocking + Sharepoint database +


Environment :- MOSS 2007 (Sp1)
Issue:- SQL blocking to the sharepoint related database.


1)      What would be causing this?

2)      What steps can be taken to avoid this?

WPF Desktop Application FullScreen blocking everything ... how?



I'm working on an access control system using WPF desktop app ... I need the app to get full screen so nobody cant access to any application on the machine (to avoid people closing the app, shutting down the pc, changing system clock, etc...). Far away I manage to do this by setting the form to maximized and the topmost property set to true ... this appears to work ok, but I'm wondering if theres another (and better) way to do this??

Basically I need to block everything else in the computer, no Alt+Tab, no Ctrl+Alt+Supr, no Alt+F4 (I was thinking to get the keyPreview event of the form, assuming the form is always topmost and the active form, and block any call if the first key is Alt of Ctrl... but again, is there a better way?).

Thanks for your time!

Blocking Issues Win 7 64 bit Framework 4


I had this problem with my existing Windows 7 64 bit install, so I wiped everything and did a fresh install.  Before installing ANYthing else, I tried to install Framework 4 using this file: en_.net_framework_4_full_x86_x64_508940.

I still get the same blocking message which looks like this:

Blocking Issues:

The setup cannot run in compatibility mode. For more information, see the <A HREF="http://go.microsoft.com/fwlink/?LinkId=164156">Readme file</A>.

The .NET Framework 4 is not supported on this operating system. For more information, see the <A HREF="http://go.microsoft.com/fwlink/?LinkId=164156">Readme file</A>.

I really need this resolved.  Can anybody help?




Hi all,

I need to write a SQL example of blocking.

I have inserts happening and some people trying to read data at the same time as the inserts. this is causing some issues.

I need to write some SQL to demostrate this...is there a simple example someone can show me please?




Threading, Blocking, Events, and Asynchronous Management


I think I have finally broken it down to what logistically could be explained for many who have trouble dealing with threads.  Naturally, of course, I don't have the answer, but I think I have the question.  Threading is always a mind boggle at times, but what is more difficult that the concept of threads is executing it in a specific framework.

There are multiple ways to handle Threading in .Net, and my questions revolve around them all, but with specificity as to the "How to code it" as opposed to "Explain the concept."

One method of threading:  The BeginXXX/EndXXX with IAsyncResult
Assumed Given:  When Calling BeginXXX(CallBack) the Callback is executed on a Secondary Thread.  Thus whatever code exists within the Callback procedure must either be self-contained, thread protected (with locks etc), and/or Synchronized if being communicated to other threads (namely the calling thread).

Another Method of Threading: Using the Thread class, and providing a TreadProc() callback method.
Assumed Given:  The ThreadProc() method is handled similarly to the Callback of the BeginXXX/EndXXX style of threading.  The difference between the two is that the BeginXXX/EndXXX style uses the ThreadPool to manage the thread, where with the Thread Class we (the programmers) are ma

Blocking issue


Hi all,

I have an upload which does a BULK insert into my Table and if at the same time as this insert I run a select statement it takes ages.

What are the possible things I can do to stop this behaviour??

please help?

Blocking Edit Document for Read only users in SharePoint 2007

I'm trying to create a group in one of my sites that is Read only - truly read only.  Seems no matter what I do, the users can click on Edit Document, check out, check in, and the document is changed.  It doesn't show as changed in the Modified or Modified By columns, but the changes I make to test are there.  How do I create a group that can open a document, but can NOT check it out, can NOT Edit Document, and then check it back in?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend