"Object reference not set to an instance of object” error in callback RRS feed

  • Question

  • I am using IHttpAsyncHandler and XMLHTTPRequest to push messages to client with the help of following URL: but I make some changes, actually this example based to one client only and I have to send messages to multiple clients so I make these changes

    public void ProcessRequest(HttpContext context)
            var recipient = context.Request["recipient"]; 
            lock (_obj)
                string[] totalfrnds = ("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20").Split(',');//<- This is just an example for many clients
                foreach (var a in totalfrnds)
                    var handle = MyAsyncHandler.Queue.Find(q => q.SessionId == a);//<- check who's client is online or not
                    if (handle != null)
                        handle.Message = context.Request["message"];

    Now I have three main problems:

    1. How to resolve this type of error? This is not a permanent error, it occurs randomly.

    2. What is the limit of asynchronous thread in W3wp.exe, as when it exceeds 25 request it can't open next request and I have to reset the IIS to start again the application.

    3. While sending messages to a no of clients, some of the clients receive messages and some of them not. like: If I'm sending messages to 20 clients simultaneously, as shown in above example, then clients 1 to 15 receive messages and 17 18 don't receive message and client 19, 20 receive message. This is not a permanent order of getting messages its random. How it can be resolved?

    Wednesday, February 20, 2013 7:19 AM