Note that there are some explanatory texts on larger screens.

plurals
  1. POCacheItemRemovedCallback causes webserver to crash
    text
    copied!<p>THis is an interesting question. I am developing a web-chat software piece and for the past couple of hours I've been trying to figure out why this happens. Basically, I add an actual chat object (the part that does communications) to the Cache collection when you start chatting. In order to detect that you closed the window, I set the sliding expiration to say 10-30 seconds. I also set the callback to let the chat client know that he needs to disconnect to end the chat session. For some odd reason, when I use the code to dispose of the chat client, whatever it is, it causes the entire w3svc process to crash (event log checked). I also tried just sending myself an email when the item is removed, which worked. I even tried to put the entire code in try-catch block but it seems to ignore that as well. Any ideas? O_o</p> <p><strong>UPD</strong>: No, i am not trying to refresh the object (<a href="http://blogs.msdn.com/b/yangxind/archive/2005/12/20/506151.aspx" rel="nofollow noreferrer">in reference to this</a>).</p> <p>Adding:</p> <pre><code>HttpContext.Current.Cache.Insert("ChatClient_" + targetCid + HttpContext.Current.Session.SessionID, cl, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(15), CacheItemPriority.Normal, new CacheItemRemovedCallback(removeMyself)); </code></pre> <p>Removing:</p> <pre><code>public static void removeMyself(string key, Object value, CacheItemRemovedReason reason) { var wc = (WebClient)value; try { wc.Remove(); } catch { } } </code></pre> <p>I am in fact using the lock on HttpContext.Current.cache when adding to the cache objects.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload