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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:29:54+00:00 2026-06-11T13:29:54+00:00

I´m having the weirdest problem. In my C# solution, I have a desktop test

  • 0

I´m having the weirdest problem.

In my C# solution, I have a desktop test application, and a service application. On the start of both applications, I call the exact same methods, and the behaviour is completely different.
My desktop application is working just fine, reads a COM port, process that info, and then inserts that data on my DB.
The service application, read the COM port fine, but then the processing of the data is completely different, and after that it throws an SQLException because it is trying to convert wrong data(Specifficaly a datetime ’01/01/0001′)

I need this application to be a Service, I´m having the desktop app just to test it. I´ve been working on services for a while and I´ve never seen this behavior before.

How is it possible that the application and the service work so different calling the same functions using the EXACT same libraries?.

Here is the code:

  • Service:

    protected override void OnStart()
    {
                    csGPS.startGPSData();
    
        Thread hiloEscuchar = new Thread(delegate()
            {
                csListener listener = new csListener();
                listener.listenAutoCommand();
            });
        hiloEscuchar.Start();
    
    
        Thread hiloEnviar = new Thread(delegate()
            {
                csSender.buscarComandos();
            });
        hiloEnviar.Start();
    
    
        Thread hiloEnviarPosiciones = new Thread(delegate()
        {
            csSender.enviarPosiciones();
        });
        hiloEnviarPosiciones.Start();
    }
    
  • Desktop App:

    private void btnComenzar_Click(object sender, EventArgs e)
    {
        csGPS.startGPSData();
    
        Thread hiloEscuchar = new Thread(delegate()
            {
                csListener listener = new csListener();
                listener.listenAutoCommand();
            });
        hiloEscuchar.Start();
    
    
        Thread hiloEnviar = new Thread(delegate()
            {
                csSender.buscarComandos();
            });
        hiloEnviar.Start();
    
    
        Thread hiloEnviarPosiciones = new Thread(delegate()
        {
            csSender.enviarPosiciones();
        });
        hiloEnviarPosiciones.Start();
    
        lblEstado.Text = "STARTED";
        btnComenzar.Enabled = false;
    
    }
    

I hope you guys can help me.

Thanks.

  • 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-06-11T13:29:55+00:00Added an answer on June 11, 2026 at 1:29 pm

    While the code may be the same, services run under an entirely different security context. They usually run under the LocalSystem user, and have no access to the desktop. This use also has very limited network access.

    You will need to debug your code as a service, or at least add some debug logging statements to try and figure out what behaves differently.

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

Sidebar

Related Questions

I'm having the weirdest problem. I have two PlaceHolders in a Master Page; one
I have the weirdest problem. I am implementing a simple gallery with a use
I have a Windows Service that overrides the OnStart and OnStop methods to call
I'm having the weirdest problem right now. In order to see if a contact
Having a problem with Scala import. I have an import problem with two classes.
I'm having the weirdest problem here with a Windows App written in c#. Although
I have been having the hardest time trying to resolve the weirdest error when
I'm having the weirdest problem ever when programming in C. My function sometimes runs
Having recently upgraded to TFS2010 I am having a problem building web applications. In
Having used storyboards for a while now I have found them extremely useful however,

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.