1

We encounter a problem while starting up an MVC 4 application. You can see the exception details in the picture. This exception is only caught by memory profiler.

The service registration code is as follows:

kernel.Bind<RepositoryFactories>().To<RepositoryFactories>().InSingletonScope();
kernel.Bind<IRepositoryProvider>().To<RepositoryProvider>();
kernel.Bind<IBlmsUow>().To<BlmsUow>();


kernel.Bind<IIdentity>().To<Blms.Web.Core.BlmsIdentity>();

//Default is FileService with IO Implementation. If missing in config, automatically use this
FileServiceFactory fileFactory = new FileServiceFactory();
string fileServiceType = ConfigurationManager.AppSettings["IFileService"];
fileServiceType = string.IsNullOrEmpty(fileServiceType) ? "FileService" : fileServiceType;
kernel.Bind<IFileService>().ToMethod(context => fileFactory.CreateInstance(fileServiceType));

kernel.Bind<IConfigurationService>().To<Blms.Service.ConfigurationService.ConfigurationService>();

// Start Register Caching
CachingFactory cachingFactory = new CachingFactory();
kernel.Bind<ICacheLayer>().ToMethod(context => cachingFactory.CreateInstance(ConfigurationManager.AppSettings["ICachelayer"])).InSingletonScope();
// End Register Caching

// Inject kernel in Providers

ServiceFactory serviceFactory = new ServiceFactory();
string emailServiceType = ConfigurationManager.AppSettings["IEmailService"];
emailServiceType = string.IsNullOrEmpty(emailServiceType) ? "MandrillService" : emailServiceType;
kernel.Bind<IEmailService>().ToMethod(context => serviceFactory.CreateInstance<IEmailService>("EmailService", emailServiceType));

serviceFactory = new ServiceFactory();
string smsServiceType = ConfigurationManager.AppSettings["ISmsService"];
smsServiceType = string.IsNullOrEmpty(smsServiceType) ? "TurkTelekomSMSService" : smsServiceType;
kernel.Bind<ISmsService>().ToMethod(context => serviceFactory.CreateInstance<ISmsService>("SmsService", smsServiceType));

serviceFactory = new ServiceFactory();
string notificationServiceType = ConfigurationManager.AppSettings["INotificationService"];
notificationServiceType = string.IsNullOrEmpty(notificationServiceType) ? "AzureNotificationService" : notificationServiceType;
kernel.Bind<INotificationService>().ToMethod(context => serviceFactory.CreateInstance<INotificationService>("NotificationService", notificationServiceType));

enter image description here

mnwsmit
  • 1,198
  • 2
  • 15
  • 31
Zafer
  • 2,180
  • 16
  • 28
  • 1
    It does not seem to be related to the ninject registrations. Could you add the contents of the Blms.Web.Controllers.BaseController constructor? – mnwsmit Mar 24 '16 at 09:33
  • 1
    Thank you for the comment. We identified the source of error with the perspective you've provided. – Zafer Mar 24 '16 at 11:40

0 Answers0