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 8073417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:20:07+00:00 2026-06-05T14:20:07+00:00

I have a windows service that I have successfully installed using installutil but when

  • 0

I have a windows service that I have successfully installed using installutil but when I run it I get an error saying that the service failed to start because it failed to respond in a timely fashion. In the Event Viewer, I can see this error.

Application: AuctionControl.Service.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: Microsoft.Practices.Unity.ResolutionFailedException
Stack:
   at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(System.Type, System.Object, System.String, System.Collections.Generic.IEnumerable`1<Microsoft.Practices.Unity.ResolverOverride>)
   at Microsoft.Practices.Unity.UnityContainer.Resolve(System.Type, System.String, Microsoft.Practices.Unity.ResolverOverride[])
   at Microsoft.Practices.Unity.UnityContainerExtensions.Resolve[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](Microsoft.Practices.Unity.IUnityContainer, Microsoft.Practices.Unity.ResolverOverride[])
   at AuctionControl.Service.Service1..ctor()
   at AuctionControl.Service.Program.Main()

My code is below

using System.ServiceProcess;
using Microsoft.Practices.Unity;

namespace AuctionControl.Service
{
    public partial class Service1 : ServiceBase
    {
        #region Constructor(s)

        public Service1()
        {
            InitializeComponent();


            _container = new UnityContainer();

            _auctionControl = _container.Resolve<Services.Engine.AuctionControl>();
        }

        #endregion

        #region Fields

        private readonly Services.Engine.AuctionControl _auctionControl;
        private readonly UnityContainer _container;

        #endregion

        protected override void OnStart(string[] args)
        {
            _auctionControl.StartAuctionControl();
        }

        protected override void OnStop()
        {
            _auctionControl.StopAuctionControl();
        }
    }
}
  • 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-05T14:20:10+00:00Added an answer on June 5, 2026 at 2:20 pm

    This isn’t to do with being a Windows Service explicitly, it’s because you haven’t set up your IoC so that Unity knows what to inject when it’s asked for an instance of something in your constructor.

    Presumably you have an interface in your AuctionControl.Service.Service1 constructor, but you haven’t told your Unity container what concrete class to bind/resolve that interface to.

    EDIT:

    Do you actually need Unity? It doesn’t seem to be doing anything useful.

    Try:

    public Service1() 
    { 
        InitializeComponent(); 
    
       _auctionControl = new Services.Engine.AuctionControl();
    } 
    

    Does this work?

    Unity should allow you to bind (generally) interfaces to concrete types at runtime to give you flexibility in testing and reduce coupling of components. Do you know why there is a Unity container in the code here?

    This line:

    _auctionControl = _container.Resolve<Services.Engine.AuctionControl>();
    

    says ‘I want a concrete instance of AuctionControl, but I dont’ want to determine exactly what type that is at compile-time and Resolve will figure it out at run-time’. However, in order for Unity to determine what to give you when you ask for an AuctionControl, you have to tell it what that Resolve call should return. To do that, you need to setup a call to RegisterType before you do any Resolve-ing, something like:

    _container.RegisterType<Services.Engine.AuctionControl, Services.Engine.AuctionControl>();
    

    which is, in this case, pointless as Services.Engine.AuctionControl always resolves to itself. (RegisterType<WhenAskedForThisType, GiveMeThisType>();).

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

Sidebar

Related Questions

I am a newbie into Windows Service I have installed my Windows service using
I have uninstalled a windows service (In Windows7 ) using installutil.exe . This states
I have a Windows service that runs as a logged-in user (local admin). During
I have a Windows Service that takes the name of a bunch of files
I have a windows service that generates logs as it does some execution. I
I have a windows service that receives a large amount of data that needs
I have a windows service that loads multiple handlers written by different developers. The
I have a windows service that has it's name set by an app.config. I
We have a C# Windows service that currently processes all the PDFs by reading
I have a VB.NET Windows Service that I wrote and it works fine. In

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.