Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

The Service on local computer started and then stopped ,Some services stop automatically if there are not in use by other services or programs

Jun 17, 2011

Introduction:

Here I will explain how to solve the Service on local computer started and then stopped, some services stop automatically if there are not in use by other services or programs

Description:

In previous article I explained clearly how to create windows service and how to run windows service in scheduled intervals and how to install windows service in system. In my system I tried to install windows service completion writing the code but at that time I was unable to install windows service I got error like this


The Service on local computer started and then stopped ,Some services stop automatically if there are not in use by other services or programs.”


Now I will explain how to solve the Service on local computer started and then stopped, some services stop automatically if there are not in use by other services or programs.

To solve this problem we have two ways 

First Way

Start --> Run --> Type Services.msc and click enter button now you will get all the services in your computer after that select your service and right click on that and go to Properties

After that open Select Log On tab in that select Local System Account and click ok now your problem will solve


Otherwise check second way.

Second Way

First right click on My Computer and select Manage now computer management window will open
In that window select Application log and right click on it and select properties now another window will open in that change maximum log size to bigger value and check Overwrite events when needed

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

25 comments :

Mehtab Ali said...

Good Suresh......:)

mis solutions said...
This comment has been removed by a blog administrator.
Priyanshu said...
This comment has been removed by a blog administrator.
Suresh Dasari said...

@mis solutions
Please don't post spam comments

Suresh Dasari said...

@Priyanshu
Please don't post spam comments

Sujith Mony said...

can you please help me whhy i am gettign this error

Windows could not start the Documentservice on local computer
Error 1053: the service didnot respond to the start or control request in a timely fashion

here Documentservice is my window service name

Sujith Mony said...

can you please help me whhy i am gettign this error

Windows could not start the Documentservice on local computer
Error 1053: the service didnot respond to the start or control request in a timely fashion

here Documentservice is my window service name

Sandesh said...
This comment has been removed by the author.
Sandesh said...
This comment has been removed by the author.
Sandesh said...

Guys no need of looking into logs and all
just put VIA protocol disabled from configuration manager. And try with restarting those services..


more details at
www.parigh.com

Anonymous said...

please check the properties of service

Venkat said...

I have done the same thing but its not working still the same error when i check the appl log file it shows the below error

Service cannot be started. System.Configuration.ConfigurationErrorsException: The binding at system.serviceModel/bindings/netTcpBinding does not have a configured binding named 'TCPBindingBasicExample.WCFServiceHost.MyServiceBehaviour'. This is an invalid value for bindingConfiguration. (E:\My-VS-Project\TCPBindingBasicExample\WCFServiceHost\bin\Debug\WCFServiceHost.exe.Config line 44)
at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at Sys...

have any idea ??

Ramesh said...

this solution doesn't work for me...Any one with other solution????????????

vipul said...

Service cannot be started. System.Web.HttpException: The transport failed to connect to the server.
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040213): The transport failed to connect to the server.

--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Type type, Object obj, String methodName, Object[] args)
at System.Web.Mail.SmtpMail.LateB...

Anonymous said...

super :) it worked...

Anonymous said...

Not working for me,it is still showing same message

Pratik said...

not working for me as well.

Anonymous said...

First way worked perfectly. Thank you!

Sunny Kumar said...

Thanks Suresh... helpful !!

sravan said...

Still am getting these error i have done those two steps
The Service on local computer started and then stopped ,Some services stop automatically if there are not in use by other services or programs

Anonymous said...

This not work for me........

poonamtemgire said...

i check 2 way but not work .........some message display .....

“The Service on local computer started and then stopped ,Some services stop automatically if there are not in use by other services or programs.”

how to solve plz help me......

Anonymous said...

Neither solution worked for me. 0/2

Heemanshu Bhalla said...

sorry to say sir both methods don't worked .....plz suggest the solution to this error

Praveen said...

I have written a email code in windows service.
Without email code it is working very well but when I am using email code then it is showing the same error. I have already tried both above solution but still there is problem. Please help me. below is the code...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.IO;
using System.Timers;
using System.Net;
using System.Net.Mail;
using System.Data.SqlClient;
namespace WinEmailService
{
public partial class EmailScheduleService : ServiceBase
{
Timer timer = new Timer();
public EmailScheduleService()
{
InitializeComponent();
}

protected override void OnStart(string[] args)
{
//add this line to text file during start of service
TraceService("start service");

//handle Elapsed event
timer.Elapsed += new ElapsedEventHandler(OnElapsedTime);

//This statement is used to set interval to 1 minute (= 60,000 milliseconds)

timer.Interval = 60000;

//enabling the timer
timer.Enabled = true;
}

protected override void OnStop()
{
timer.Enabled = false;
TraceService("stopping service");
}
private void OnElapsedTime(object source, ElapsedEventArgs e)
{
TraceService("Another email send at " + DateTime.Now);
}
private void TraceService(string content)
{
//set up a filestream
FileStream fs = new FileStream(@"d:\EmailSendTest.txt", FileMode.OpenOrCreate, FileAccess.Write);

//set up a streamwriter for adding text
StreamWriter sw = new StreamWriter(fs);

//find the end of the underlying filestream
sw.BaseStream.Seek(0, SeekOrigin.End);

//add the text
sw.WriteLine(content);
//add the text to the underlying filestream

sw.Flush();
//close the writer
sw.Close();

SmtpClient m = new SmtpClient("smtp.rediffmailpro.com");
m.Port = 587;
m.UseDefaultCredentials = true;
MailAddress To = new MailAddress("impraveen26@gmail.com");
MailAddress From = new MailAddress("abc@gmail.com");
MailMessage mm = new MailMessage(From, To);
mm.Subject = "Automatic mail--- Testing -----";
mm.IsBodyHtml = true;
mm.Body = "Testing......";
m.Credentials = new System.Net.NetworkCredential("abc@gmail.com", "password");
m.DeliveryMethod = SmtpDeliveryMethod.Network;
m.Send(mm);

}
}
}

Give your Valuable Comments

Other Related Posts

© 2010-2012 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.