Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8290059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:41:06+00:00 2026-06-08T12:41:06+00:00

I am about to go live with an application I have built using ASP.Net

  • 0

I am about to go live with an application I have built using ASP.Net MVC 3 and Entity Framework 4.1. For dependency injection I used the Unity 2.0 IoC. I used this tutorial as a guide to help setup the Unity IoC http://weblogs.asp.net/shijuvarghese/archive/2011/01/21/dependency-injection-in-asp-net-mvc-3-using-dependencyresolver-and-controlleractivator.aspx

Today I was checking through my code for any last minute bug fixes and I came across the
Application_Start() method in my Global.asax file. It looks something like this

    protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();

        RegisterGlobalFilters(GlobalFilters.Filters);
        RegisterRoutes(RouteTable.Routes);
        IUnityContainer container = new UnityContainer();

        container.RegisterType<IControllerActivator, CustomControllerActivator>(new HttpContextLifetimeManager<IControllerActivator>());

        //container.RegisterType<IUnitOfWork, UnitOfWork>(new ContainerControlledLifetimeManager());
        container.RegisterType<IUnitOfWork, UnitOfWork>(new HttpContextLifetimeManager<IUnitOfWork>());

        container.RegisterType<IListService, ListService>(new HttpContextLifetimeManager<IListService>());
        container.RegisterType<IShiftService, ShiftService>(new HttpContextLifetimeManager<IShiftService>());

}

The application is working fine, but I noticed I was missing the line of code

DependencyResolver.SetResolver(new UnityDependencyResolver(container));

Which goes after the line

IUnityContainer container = new UnityContainer();

As I say, my application was working fine (locally anyway) without this line of code. I have since added it and the application is again working as expected.

However, I am a bit worried that my Unity IoC wasn’t setup correctly. Why did my application work even without this additional line of code? And do I even need to add it?

Thanks for your help.

Update

Below shows the constructor for one of my Controllers

public class AccountController : Controller
{
    private IAccountService _accountService;
    private IUserService _userService;
    private IFormsAuthenticationService _formsService;
    private INotificationService _notifyService;
    private ILoggingService _logService;

    public AccountController(ILoggingService logService, IAccountService accountService, IUserService userService, IFormsAuthenticationService formsService, INotificationService notifyService)
    {
        _accountService = accountService;
        _userService = userService;
        _formsService = formsService;
        _notifyService = notifyService;
        _logService = logService;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T12:41:07+00:00Added an answer on June 8, 2026 at 12:41 pm

    Folks

    Please ignore this question. I found out that the line

    DependencyResolver.SetResolver(new UnityDependencyResolver(container));
    

    was included in my code after all.

    Note to self – look harder at your code next time!!!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application written in ASP.NET and using EF. I want to make
We currently have a Live ASP.NET application (Basically a CMS) running on our IIS7
for more details about the live id : https://accountservices.passport.net/ppnetworkhome.srf I have seen jar files
I have a small application developed in ASP.NET 2.0 WebForms. For learning purpose, I
If I have an application running on ASP.net and I have debug and stacktrace
I have developed one asp.net web application and now i would like to add
On http://www.slideshare.net/eljefe/automated-deployment-with-phing in slide 15 they are talking about locking the live site when
I am looking for different techniques/tools you use to deploy an ASP.NET web application
I have a superclass Entity in a logic-tier project within existing 3-tier core application
I'm about to deploy an application to a live server and right now I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.