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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:30:47+00:00 2026-05-13T10:30:47+00:00

I have stumbled upon a situation where I cannot start more than a certain

  • 0

I have stumbled upon a situation where I cannot start more than a certain number of .Net windows services. Our software system is as set of 8-9 windows services and I want to create 5 logical environments on one machine (i.e about 40 services). To reproduce the problem and to prove that it is not an application issue I created a simple windows service.

I am compiling it to TestService.exe and then creating 30 copies of it. From TestService01.exe to TestService30.exe.
I am installing the services using SC as shown below

SC create "Test Service Copy 01" start= demand binpath= "C:\Temp\TestService\TestService01.exe" obj= "mydomain\myservices" password= "myservicepwd" displayname= "Test Service Copy 01"

Now I can start somewhere between 15 and 25 of those services on a windows server 2003 machine. After that I can’t start another service. It fails with the error messagebox

TestService18.exe - Application Error 
--------------------------- 
The exception unknown software exception (0xc06d007e) occurred in the application at location 0x7c812afb. 


--------------------------- 
OK   Cancel    
---------------------------  

What can be causing this error. Is there a upper limit on the number of .Net service you can run on a windows server ?

I have asked this on ServerFault already. The link is here

The code:

using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.ServiceProcess;
using System.Threading;

namespace TestService
{
    public class MyService : ServiceBase
    {
        private Timer stateTimer;
        private readonly TimerCallback timerDelegate = WriteToLog;
        static readonly string fileName = @"C:\temp\Testservice\Log\" + new Random().Next() + ".txt";
        public MyService()
        {
            ServiceName = "Test Service";
            CanStop = true;
            CanPauseAndContinue = false;
            AutoLog = true;
        }

        protected override void OnStart(string[] args)
        {
            using (StreamWriter writer = new StreamWriter(fileName, true))
            {
                writer.WriteLine("Starting ...");
                writer.WriteLine(Assembly.GetExecutingAssembly().Location);
            }
            stateTimer = new Timer(timerDelegate, null, 1000, 1000);
        }

        protected override void OnStop()
        {
            stateTimer.Dispose();
        }

        static void WriteToLog(object stateObject)
        {
            using (StreamWriter writer = new StreamWriter(fileName, true))
            {
                writer.WriteLine(DateTime.Now.Ticks);
            }
        }

        public static void Main()
        {
            Run(new MyService());
        }
    }
}
  • 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-05-13T10:30:48+00:00Added an answer on May 13, 2026 at 10:30 am

    You’re probably running into the well-known desktop heap limitation, which by default limits the amount of memory related to user-interface and desktop-related that things can consume to 48 MB. A typical service probably consumes a few hundred kilobytes of desktop heap, so it’s not surprising that you can only start 20 or so given the other apps that are running on your system.

    For more info, see this excellent ntdebugging article.

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

Sidebar

Related Questions

I have stumbled upon the following F77 yacc grammar: http://yaxx.cvs.sourceforge.net/viewvc/yaxx/yaxx/fortran/fortran.y?revision=1.3&view=markup . How can I
I have stumbled upon a really annoying situation: I am using Hibernate & Spring
I'm pretty new in iphone programming and have stumbled upon this issue which I
I'm mucking about with jQuery AJAX and have stumbled upon an oddity (or rather
I have recently stumbled upon a problem with selecting relationship details from a 1
I have just stumbled upon the bash syntax: foo=42 bar=$[foo+1] # evaluates an arithmetic
I stumbled upon Jtalk here http://nicolaspetton.github.com/jtalk/index.html#download but when clicking on download I have 404
Just stumbled upon propertyGrid and its awesome! However, i have one task that i
I have a crazy situation that I cannot figure out: I have this string:
I have stumbled upon a problem when calling a nested Async which happens to

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.