I have created my c# console application as windows service and installed the service in remote server which is 32 bit machine and has 2GB RAM.
To this server application many clients are connected and gets the data from server.
The problem is sometimes the server machine is down and unable to access the data, that time we need to restart the server every time.I have not able to identify where exactly the problem is.
When i was checking the evenlogs in server machine i found the below exception,
source .net 2.0 runtime error.
EventType clr20r3, P1 myapplication.exe, P2 1.3.2.1, P3 4cb724a3, P4 mscorlib, P5 2.0.0.0, P6 4be90358, P7 1947, P8 7, P9 system.outofmemoryexception, P10 NIL.
I have googled a lot, but unable to find exact reason.
I am using HTTPSERVER.MVC (opensource) for url communication.
To create service below code is added in the main function.
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new TouchService()
};
ServiceBase.Run(ServicesToRun);
Please some one help me out.
Thanks in advance
The reason is – you are out of memory.
In .Net this doesn’t necessarily mean that there is physically no more memory, it just means that the CLR was unable to find enough contiguous memory to allocate something. This can be due to huge amounts of memory already being allocated, or due to memory fragmentation.
Without knowing more about your application it is difficult to give more than general advice, but a few pointers are:
These are just some random thoughts, but I would suggest getting a basic understanding of CLR memory management and garbage collection if you don’t already, try some monitoring and profiling, and take a critical look at your code.