title: StructureMap working locally, but not on production server
body: <p>I developing a MVC5 application, where I am using StructureMap as my DI framework. The application works fine, when I run it locally from Visual Studio. However when I publish to our production server, I get the "No parameterless constructor..." error. I've Googled a solution and found a suggestion to add the code below to an empty constructor in the controller, in order to get a more detailed exception:</p>
  
  <pre><code>public class HomeController : Controller
  {
      public HomeController()
      {
          _bll = StructureMap.ObjectFactory.GetInstance&lt;IAgentStatsBll&gt;();
      }
  
      private IAgentStatsBll _bll;
  
      public HomeController(IAgentStatsBll bll)
      {
          _bll = bll;
      }
  
      public ActionResult Index()
      {
          HomeViewModel model = new HomeViewModel {Authors = _bll.GetAuthorsWithCommentsOnDate(DateTime.Now.AddDays(-60))};
          return View(model);
      }
  }
  </code></pre>
  
  <p>When I run this code on the production server, I get an error saying:</p>
  
  <pre><code>No default Instance is registered and cannot be automatically determined for type 'ZendeskAgentStats.BLL.IAgentStatsBll'. 
  There is no configuration specified for ZendeskAgentStats.BLL.IAgentStatsBll
  </code></pre>
  
  <p>If I understand the error correct, it says that SM cannot figure out which concrete type it should use for the IAgentStatsBll interface. However this is configured in the DefaultRegistry.cs:
      public class DefaultRegistry : Registry {
          #region Constructors and Destructors</p>
  
  <pre><code>    public DefaultRegistry()
      {
          Scan(
              scan =&gt;
              {
                  scan.TheCallingAssembly();
                  scan.AssemblyContainingType&lt;IAgentStatsBll&gt;();
                  scan.AssemblyContainingType&lt;IAgentStatsDal&gt;();
                  scan.AssemblyContainingType&lt;IAgentStatsContext&gt;();
                  scan.AssemblyContainingType&lt;ZendeskAPIMethods&gt;();
                  scan.WithDefaultConventions();
                  scan.With(new ControllerConvention());
              });
          For(typeof(IGenericRepository&lt;&gt;)).Use(typeof(GenericRepository&lt;&gt;));
      }
  
      #endregion
  }
  </code></pre>
  
  <p>Can anyone figure out why it is working locally but not on the server?</p>