ResolutionFailedException raised though the web.config file has proper types defined.

Jul 27, 2012 at 6:18 AM

Hi all,

This is Kumar. We have prepared a WCF webservice where we have used UnityContainer and defined named type "Description" in container in web.config file of WCF servcie as shown below. 

<type name="Closed" type="BusinessLogic.IProcessor, BusinessLogic" mapTo="BusinessLogic.ClosedProcessor, BusinessLogic"/>

Below is the line of code to resovle the container with Description="Closed"
IProcessor plugin = m_container.Resolve<IProcessor>(Description);
Right now, the WCF service in production environment where there would be heavy traffic to this WCF service. Most of the times, its working perfectly with out any issues. But, "sometimes", it is throwing "ResolutionFailedException". We are unable to reproduce the issue in any means and we suspect that there should be threading issue with the Unity container.

Is this UnityContainer thread safe in conjunction with WCF webservice environment?

Could you please let us know if anyone of you have observed this kind of issue in WCF webservice application and are there any known defects in Unity framework?

Please do not hesitate to ask further information if required.



Jul 27, 2012 at 8:01 AM

Resolution methods should be thread safe.  Unity has an issue tracker but I don't see anything matching your description in the list.  Are you sure that the description is "Closed"?  Is there any way for it to be set to another value?

However, your scenario reminds me of another posting: .  It's not identical but seems similar.

In terms of behavior, once you get a ResolutionFailedException do you keep getting an exception resolving that type but other resolutions are succeeding?

Have you been able to see any patterns in the "sometimes"?  Could it be on App pool shutdown or startup? 

Randy Levy
Enterprise Library support engineer 

Aug 3, 2012 at 1:12 AM

There is a fix out via NuGet for IndexOutOfRangeException.  See this post:  It's not your exact issue but it may help.

Randy Levy
Enterprise Library support engineer