I was wondering if someone has a clue of what is happening here, and could point me in the right direction.
Ok ..lets put the code in context.
I have ajax methods (jquery) like this:
$xmlHttp("/Api/GetWaitingMessages", { count: 20 })
.always(processResult);
($xmlHttp simply wraps a jQuery defered, and some basic $ajax options)
And in our healthmonitoring back-office i see things like this:
Exception information:
Exception type: System.ArgumentException
Exception message: The parameters dictionary contains a null entry for parameter 'count' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult GetWaitingMessages(Int32)' in 'AjaxController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameter name: parameters
Now the thing is, i placed some traces & try/catches (for testing) to make sure that jQuery never calls GetWaitingMessages with an empty or undefined "count", but as far as the healthmonitoring exeptions go: GetWaitingMessages was instantiated and passed null as a parameter. (from what i understand, MVC instantiates methods via reflection)
btw: the error only happens like maybe 1 out of many thousands of requests
The signature of GetWaitingMessages is:
public virtual ActionResult GetWaitingMessages(int count)
{
....
}
So i suppose, mvc shouldn't even hit the method since there should be no signature match..
Does MVC have problems with high traffic websites (ie. multi-threading problems) ?
The site mentioned above is running on a cluster of 5 web-farm servers with Network Load Balancing and IP affinity.
Each server gets around 1500 request/sec at peak times.
The site is using url rewriting to map domains to areas (ie test.com will simply insert /test into the url) since it's a skinable & multilingual white label site.
Some more details on site configuration:
The controller that serves ajax requests is decorated with
[SessionState(SessionStateBehavior.Disabled)]
HttpModules that where considered useless where removed since we need to run: runAllManagedModulesForAllRequests="true" in MVC. I could have set runAllManagedModulesForAllRequests="false", and then try to figure out what to add, in which order, but found it simpler to just remove what i know is not essential.
<remove name="AnonymousIdentification" />
<remove name="Profile" />
<remove name="WindowsAuthentication" />
<remove name="UrlMappingsModule" />
<remove name="FileAuthorization" />
<remove name="RoleManager" />
<remove name="Session" />
<remove name="UrlAuthorization" />
<remove name="ScriptModule-4.0" />
<remove name="FormsAuthentication" />
The following are all activated and configured in the web.config
<pages validateRequest="false" enableEventValidation="false" enableViewStateMac="true" clientIDMode="Static">
and also:
urlCompression
staticContent
caching
outputCache
EDIT : just analyzed my trace logs a bit more. When the error occurs, i see (Content-Length: 8), which corresponds to (count=20). However i do not see any query parameters in the logs. I dumped the HttpInputStream to the logs, and it's completely empty ..but like i just mentioned, the logs also say that Content-Length = 8, so something is very wrong here.
Could IIS (eventually url rewriting) be mixing up it's stuff somewhere along the way ?
-
Any help would be greatly appreciated ..i'm ripping my hair out trying to understand what could possibly be going wrong here.
Thanks, Robert