Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I believe <code>AppInitialize()</code> is the method you're looking for. Here's an article on using it to initialise Castle Windsor in a WAS hosted WCF service:</p> <blockquote> <p><a href="http://consultingblogs.emc.com/matthall/archive/2009/08/18/castle-windsor-and-non-http-protocol-wcf-services.aspx" rel="noreferrer">Castle Windsor and non-HTTP Protocol WCF Services</a></p> </blockquote> <p>The essence of the article is, instead of using <code>Application_Start()</code> which won't get called in WAS:</p> <pre><code>protected void Application_Start(object sender, EventArgs e) { var container = new WindsorContainer("ioc.config"); DefaultServiceHostFactory.RegisterContainer(container.Kernel); } </code></pre> <p>Use:</p> <pre><code>public class InitialiseService { /// &lt;summary&gt; /// Application initialisation method where we register our IOC container. /// &lt;/summary&gt; public static void AppInitialize() { var container = new WindsorContainer("ioc.config"); DefaultServiceHostFactory.RegisterContainer(container.Kernel); } } </code></pre> <p>To quote Matt:</p> <blockquote> <p>I confess I spent a while looking at the Host Factory in more detail, looking to wrap the <code>DefaultServiceHostFactory</code>. However, there appears to be a far simpler solution and that is to make use of the little documented AppInitialize method. If you create a class (any class), put it into the ASP.NET <code>App_Code</code> folder in your project and give it a method signature as defined below, this little baby will get fired exactly when you want it to. You can then initialise your IoC container in there.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload