Windows Services Error in C #

I am using C #. At this time I am using Windows 7. My question is: When I run my code, that gives me errors, etc. Error 193: 0xc1, services are started, but after stopping, 1053 service 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,

+3
source share
3 answers

Some things to check. It happened to me, from my head:

  • Is there anything in the event logs? Sometimes they can give you a clue.

  • Complete event log? If Windows cannot write it, it will not start the service. Try to clear the application event log and see if it starts.

  • Are there any syntax errors in the .config file? Once we had a problem with the .msi installer, which put the <endpoint> tag after the end </configuration>

  • , . , , ?

  • Debugger.Break() OnStart(), Windows Visual Studio . , , , OnStart .

  • <endpoint> app.config/web.config, ?

+2

, , Windows , .

+1

, : http://support.microsoft.com/default.aspx?scid=kb;en-us;Q325680

In my case, exe was in C: \ Documents ands Settings .... and a file called C: \ Documents appeared. Deleting this file helped, but I'm still looking for a way to solve this problem programmatically.

0
source

Source: https://habr.com/ru/post/1787158/


All Articles