This project is read-only.

Wcf extension doesn't support file-less wcf activation

Aug 11, 2014 at 11:52 AM
The SimpleInjectorServiceHostFactory doesn't provide the method below. And If we use file-less activation, iis calling this particular method with constructorString which is an assembly qualified name.
public override ServiceHostBase CreateServiceHost(string constructorString, Uri[] baseAddresses)
            var type = Type.GetType(constructorString, false, true);
            return CreateServiceHost(type, baseAddresses); //calling SimpleInjectorServiceHostFactory.CreateServiceHost()
I've inherited the class and added this method. Also, I've added assembly resolver to global.asax to resolve type from string with Type.GetType:
protected void Application_Start()
            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainAssemblyResolve;

        static Assembly CurrentDomainAssemblyResolve(object sender, ResolveEventArgs args)
            var currentAssemblies = AppDomain.CurrentDomain.GetAssemblies();

            return currentAssemblies.FirstOrDefault(assembly => assembly.FullName == args.Name || assembly.GetName().Name == args.Name);
Aug 31, 2014 at 9:18 PM
My humble apologies for this long silence.

The CreateServiceHost(string, Uri[]) method is defined in the ServiceHostFactory class that the SimpleInjectorServiceHostFactory overrides. SimpleInjectorServiceHostFactory doesn't override this method, because I would say that there is no reason to do so. The CreateServiceHost(string, Uri) constructs the Type instance based on the supplied constructorString and calls into the protected CreateServiceHost(Type, Uri[]) method, which is actually overridden by the SimpleInjectorServiceHostFactory.

Have you got more information for me on this issue. What exception and stacktrace are you getting and what constructorString value is IIS passing that can't be found. You now created a simplified but custom implementation of that CreateServiceHost(string, Uri[]) method, but if you look in the original implementation (using Reflector for instance) you'll see that this implementation goes through great length in finding the type in the application. Difference though is that this implementation calls Type.GetType(constructorString, false) where you call Type.GetType(constructorString, false, true), which basically means that you are ignoring casing, while the original implementation is case sensitive. Could it be that there's some casing typo in your configuration file which causes the type to not be found?