mardi 22 décembre 2015

Website under load throws StructureMap Exception Code: 202

The website works with a few users but when the website is under load (From VS Load Test) the following exception is thrown:

StructureMap Exception Code: 202 No Default Instance defined for PluginFamily MyProject.IRepository

  • StructureMap version 2.6.2
  • ASP.Net MVC 3

StructureMap config

ObjectFactory.Initialize(x =>
        {
            x.Scan(
                    scanner =>
                    {
                        scanner.AssembliesFromApplicationBaseDirectory(p => p.FullName.StartsWith("MyProject"));

                        // add registry types
                        scanner.LookForRegistries();
                    });
            x.AddRegistry<ServiceRegistry>();
            x.AddRegistry<DataRegistry>();
            x.AddRegistry<LogicRegistry>();
        });

DataRegistry

For(typeof(IRepository<>)).Use(typeof(EntityRepository<>));

Exception is thrown here:

 var controller = ObjectFactory.GetInstance(controllerType) as Controller;

Debug

ObjectFactory.WhatDoIHave() shows the following

IRepository (IRepository)
Scoped as: Transient

3bd2b6ef-80e9-4b98-9c04-f59c44fc6d8b Configured Instance of MyProject.EntityRepository, MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

IRepository (IRepository)
3bd2b6ef-80e9-4b98-9c04-f59c44fc6d8b Configured Instance of MyProject.EntityRepository[[MyProject.Person, MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Scoped as: Transient

3bd2b6ef-80e9-4b98-9c04-f59c44fc6d8b Configured Instance of MyProject.EntityRepository[[MyProject.Person, MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

Aucun commentaire:

Enregistrer un commentaire