Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Services Error in C#

Tags:

c#

I using c#. At this time I using Windows 7.My question is ; When I running my code, that's gives me errors etc 193:0xc1 error , Services started but after stopped , 1053 services errors. Here is my code.

    public RupdaterService()
    {
        InitializeComponent();
        this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(this.timer1_Elapsed);
    } 
      protected override void OnStart (string[] args)
    {
        timer1.Enabled=true;
        this.DBEntry("Service Started");
    }
      protected override void OnStop()
    {            
        this.timer1.Enabled = false;
        this.DBEntry("Service Stopped");
    }

    private void timer1_Elapsed(object sender,System.Timers.ElapsedEventArgs e)
    {

        this.DBEntry("Service Running");
        }


 Here is my App.Config.

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<configSections>

    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c5***9" >
        <section name="HedefliRUpdater.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5***9" requirePermission="false" />
    </sectionGroup>
</configSections>

<system.serviceModel>

</system.serviceModel>

<applicationSettings>
    <HedefliRUpdater.Properties.Settings>
        <setting name="HedefliRUpdater_srvHedefli_wsrvHermesHedefliMesaj"
            serializeAs="String">
            <value>http://***.com/hedefli/srvHedefli.asmx</value>
        </setting>
    </HedefliRUpdater.Properties.Settings>
</applicationSettings>

Thanks in advance,

like image 475
Arbelac Avatar asked Jul 26 '26 11:07

Arbelac


1 Answers

Some things to check. These happened to me, off the top of my head:

  1. Is there anything in the Event Logs? They can sometimes give you a clue.

  2. Is the Event Log full? If Windows can't write to it, it won't start the service. Try clearing the Application event log and see if it starts.

  3. Are there any syntax errors in the .config file? We once had a problem with an .msi installer that put an <endpoint> tag after the end of </configuration>

  4. It looks like you're writing to a database. Does the user that the service runs under have access to that database?

  5. Try putting Debugger.Break() at the beginning of your OnStart() to prompt Windows to connect an instance of Visual Studio when it starts up. At the very least, it'll tell you if the fault is happening before it gets to your OnStart, or after.

  6. Do you have more than one <endpoint> specified in the app.config/web.config file that matches the same contract? Try removing the superfluous endpoint

like image 81
Chris Wenham Avatar answered Jul 28 '26 02:07

Chris Wenham



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!