openrasta/openrasta-structuremap — Issue #2: Intermittent “No Default Instance defined for PluginFamily” exceptions
Author: liddellj
Created: 2012-03-06 08:53:07+00:00
State: open

For background on this issue, please refer to the following (now read-only) OpenRasta Google Group: http://groups.google.com/group/openrasta/browse_thread/thread/67df7a648a9cd843/cf8558b3c632601b?#cf8558b3c632601b and then the following StackOverflow question: http://stackoverflow.com/q/9481236

I'm seeing intermittent behaviour whereby StructureMap is returning "No Default Instance defined for PluginFamily" errors when resolving types in OpenRasta. Which type is referred to is inconsistent. Sometimes it is an internal dependency of OpenRasta, sometimes it is one of our own handlers. Sometimes everything works as it should without issue.

The situation is easy to reproduce both locally, using Cassini, and on our test server, Windows 2008 R2 x64 running IIS 7.5. Generally it manifests itself when there is a series of rapid requests against the same OpenRasta service. In our case, we have a web app which is issuing a number of AJAX requests against the service in quick succession. This would appear to suggest that it is somehow timing related. We don't see the issue if we issue single requests at a time.

OpenRasta 2.0. and 2.1.

StructureMap 2.6.3.

One of the comments against the SO questions from another user suggests states "The reason we think it's happening is because of the way structure map works with regards to registration of objects using funcs. Basically you end up with the wrong web context."