WCF Operations - Lesson Learned

Jan 6, 2014 at 11:40 PM
Because I could not find a similar thread for this exception by googling and spent an hour debugging for the solution, here is a lesson learned! Hopefully it will save someone trouble down the road.

If you receive an exception like this:
SimpleInjector.ActivationException: The registered delegate for type ISomething<Type1, Type2> threw an exception. The ISomethingFactory`1 is registered as 'PerWcfOperation', but the instance is requested outside the context of a WCF operation.
The fix, at least for me, was to add:
Factory="SimpleInjector.Integration.Wcf.SimpleInjectorServiceHostFactory, SimpleInjector.Integration.Wcf"
To the *.svc file's markup (the file with the <% %> tags)
Marked as answer by dot_NET_Junkie on 1/6/2014 at 5:46 PM