Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Scenario: Many users (between 10 & 100) are browsing the site, and as they browse, URL Rewrite / Redirect rules are being toggled. The application crashes at random times with the following message logged in the exception log table (we use Enterprise Library Exception framework):

Common Language Runtime detected an invalid program

Details:

An exception of type 'System.InvalidProgramException' occurred and was caught.  ------------------------------------------------------------------------------  07/12/2011 12:02:20  Type : System.InvalidProgramException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089  Message : Common Language Runtime detected an invalid program.  Source : App_Web_wvjyf0pr  Help link :   Data : System.Collections.ListDictionaryInternal  TargetSite : System.Web.UI.WebControls.Panel __BuildControlpnlSearchResult()  Stack Trace :    at ASP.my_underscore_seperated_page_name_aspx.function() at ...

Server: Windows 2008R2

.Net: 3.5

WebServer: IIS7

Oddly, on enabling failed request tracing on IIS to capture status codes 400 - 506, no requests/responses were captured.

I understand every time a rule is toggled, Web.config is modified. Can modifiying Web.config too frequently be a cause?

Rules in Web.Config look like the follows:

<rule name="Redirect Rule For Page Name" enabled="false" stopProcessing="true">
  <match url="PageName" />
  <conditions>
    <add input="SiteFolder/SubFolder/PageName.aspx" pattern="^(SiteFolder/)([^.])+(PageName.aspx)$" />
  </conditions>
  <action type="Redirect" url="http://www.MySite/SiteFolder/NewPage.aspx" appendQueryString="false" />
</rule>

Any help is appreciated.

share|improve this question

1 Answer 1

Pretty sure that every time a web.config file is touched, the AppDomain for it is restarted.

It's plausible to me that you could be getting requests picked up by an AppDomain that's shortly thereafter aborted and the app cleaned up.

Cue Scott:

http://weblogs.asp.net/owscott/archive/2006/02/21/ASP.NET-v2.0-_2D00_-AppDomain-recycles_2C00_-more-common-than-before.aspx

share|improve this answer
    
Does this mean the rules shouldn't be enabled / disabled when the application is being used? Restarting app domain would still be alright, if the .NET guaranteed that the application would respond to all requests correctly. What we also observed was once the user got the CLR detected invalid program error, it did not go away until we manually restarted the app pool for the site. –  user162272 Jul 14 '11 at 4:08
    
If an app's going away, it's not going to respond to all requests correctly (same deal with recycling). If you mean "fail gracefully", that'd be my preference too - I don't know why it isn't, or wouldn't, except that too many changes could mangle something fundamental (or external things could mangle something, like AV). –  TristanK Jul 14 '11 at 7:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.