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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:27:34+00:00 2026-06-18T22:27:34+00:00

I have created an instance of TCP listener (network socket) as a TopShelf Windows

  • 0

I have created an instance of TCP listener (network socket) as a TopShelf Windows service. Since this project is a service with Main() and not a class library, I’m not certain how to create a constructor that will permit me to inject a callback.

Specifically, the idea is that when the TCP listener receives a message, it should invoke the injected callback method. Normally with a class library I would create a constructor taking as argument ICallback and instantiate accordingly.

Can I perform constructor injection with my TopShelf service? If so, how?

  • 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-18T22:27:35+00:00Added an answer on June 18, 2026 at 10:27 pm

    With something like this:

        HostFactory.New(x =>
                    {
                        x.SetDisplayName("Your service");
                        x.SetServiceName("yourservice");
                        x.Service<MyService>(c =>
                        {
                            c.SetServiceName("My service");
                            c.ConstructUsing(name => container.Resolve<MyService>());
                            c.WhenStarted(s => s.Start());
                            c.WhenStopped(s => s.Stop());
                        });
    
                    })
                        .Run();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a instance variable in rails project, which gets its value from
I have created a multi-instance performance counter and I pass it mixed case instance
I have created my custom MembershipProvider. I have used an instance of the class
I have a student class and every student instance created needs to be stored
I have a org.eclipse.swt.browser.Browser instance created in a composite. I would like to know
I have an instance of the Popen class created through subprocess.Popen. I would like
From here I have seen it suggested that an instance of RichTextBox be created
Hi stackoverflow friends, I have an instance that ,In symfony2 I created a security
I have created an eventfd instance in a userspace program using eventfd(). Is there
I have a Windows server 2008 R2 64 bit with a VMware instance of

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.