Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot inject WCF Service dependency in ASP.NET MVC with StructureMap
    primarykey
    data
    text
    <p>I have troubles injecting a WCF ServiceClient to a Controller's constructor using StructureMap.</p> <p>I followed <a href="http://haacked.com/archive/2007/12/07/tdd-and-dependency-injection-with-asp.net-mvc.aspx" rel="nofollow noreferrer">Phil Haack's example on DI in ASP.NET MVC</a></p> <p>The WCF service I have is called LogService. It implements ILogService.</p> <p>The StructureMap.config looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;StructureMap&gt; &lt;Assembly Name="Yakinix.Admin.Web" /&gt; &lt;Assembly Name="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&gt; &lt;PluginFamily Type="System.Web.Mvc.IController" Assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"&gt; &lt;Plugin Type="Yakinix.Admin.Web.Controllers.HomeController" ConcreteKey="home" Assembly="Yakinix.Admin.Web" /&gt; &lt;/PluginFamily&gt; &lt;PluginFamily Type="Yakinix.Admin.Web.LogService.ILogService" Assembly="Yakinix.Admin.Web" DefaultKey="WcfLogService"&gt; &lt;Plugin Assembly="Yakinix.Admin.Web" Type="Yakinix.Admin.Web.LogService.LogServiceClient" ConcreteKey="WcfLogService" /&gt; &lt;/PluginFamily&gt; &lt;/StructureMap&gt; </code></pre> <p>The error getting thrown is this:</p> <blockquote> <p>StructureMap Exception Code: 200<br> Could not find an InstanceMemento for the requested InstanceKey "WcfLogService" of PluginFamily Yakinix.Admin.Web.LogService.ILogService</p> </blockquote> <p>Do you have any ideas?</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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