This project is read-only.

Wcf ServicHostFactory

Mar 21, 2015 at 10:16 PM
Hi I'm not sure if this is a bug or not but after updating to Simple Injector 2.7.3 and Simple Injector WCF Integration 2.7.3 I noticed that on first time app load the ServiceHostFactory loads up my "initialization" but when the app pool recycles it doesn't get called again.

Am I doing something wrong, everything seems to be working fine when using version 2.7.2.
Mar 22, 2015 at 12:45 PM
I find this unlikely to be caused by the 2.7.3 WCF integration. The sole difference between 2.7.2 and 2.7.3 is how types are loaded during a call to .RegisterWcfServices(Assemblies[]). In 2.7.3 this method is less likely to fail when supplied with dynamic assemblies.

What you see is something I say in the past while working with WCF. During development, Visual Studio or IIS somehow decides to reuse the same app domain, even though your application is recompiled, preventing the application start-up code from being ran. This seems to be some bizarre optimization done by Microsoft, but this doesn't really make sense IMO. I have no idea how to work around this. What I did in the past was stopping IIS express. Things got much better when I started to send JSON objects over the wire as discussed here. But I'm not sure whether that would do the trick for you.
Mar 22, 2015 at 10:57 PM
You are correct, I updated the package again today and all is running as expected.

If anyone is interested in what's happening on WCF startup and what gets cached/executed they can read this post:

Ps. Thanks for the simple and fast IoC and for the great support!
Mar 23, 2015 at 11:26 AM
You're welcome :-)