Two questions about Windows Services

Hi

I have written a Windows service that sends me an e-mail every three seconds. At first, the e-mail contained the text "Hello". But then I wanted to change the text, so I stopped the service, uninstalled it, changed the source code so that the e-mail should contain the text "Hi there", compiled it and installed it again. But I still get "Hello" every three seconds. Even tried to reboot the computer.

Another problem is that the e-mails don't arrive in real-time. They seem to queue up and get sent as a batch when I stop the service. So if I let the service run for a minute, nothing happens, but when I stop it, I suddenly get a whole lot of e-mails.

Any help would be much appreciated.


Thanks


Answer this question

Two questions about Windows Services

  • sureshv

    The email problem (arriving in batches), is going to be related to the mail server and how it works, also in the way that you mail client connects and gathers the mail. Also having the mail send in 3 second breaks could be detected as spam by the mail server and slowed down.



  • hr0nix

    Another thing...

    My service loops through all files in a directory, and if any of the files are newer than a given datetime, a mail is sent to me.

    Now, when I test this in Visual Studio (not running as a service), it works great, but when I run it as a Windows Service, the method that sends the mail is fired twice, with 62 milliseconds in between.

    Anyone

  • SuperArmySolder

    Hi guys

    I solved it by changing the version number.

  • Dennes Magayanes

    It dosn't matter where the mail server is located, there are internals developed into the mail server system to provent flooding. One of the guys in the network area might correct me here but if I understand it correcly, behind the scenes the system net classes and mail create a raw telnet session to the smpt server that you use and send smpt commands to the smtp server. All the system net classes are are a wrapper for these smtp commands.



  • RAJIB14

    The mail server is an MS Exchange server within the same LAN. It must be the service that queues up the e-mails, because they all arrive the second I stop it.

  • Gil Fefer

    Have you actually rebuilt the installer project, it does not get built each time you build the solution - you must select it and rebuild it.

  • Project Glitch

    Ok.

    What about the other thing Why cant I update the service with a new version It's almost like the MSIL code has been cached or something. And it doesn't matter if I reboot the system.

    Thanks guys

  • StarSS

    Post some code up and people can see what you're trying to see.. As for the code not updating, depends on how you have built up the code. Are you installing things into the GAC Have you checked the location that you have installed the service too in the services snap-in is it in the correct location
  • Tamil mannan

    One more question though...

    When you say the "installer project", you mean the Setup project, right

    My solution looks like this:

    Solution TestService (2projects)
    TestServiceProject
    testservice.cs
    testservice_installer.cs
    TestService_SetupProject
    Dependencies
    Primary output


    So the installer class and the setup project are two different things, and I don't think you can build the installer class alone.

    By the way -- and this might seem trivial --what is the difference between building and rebuilding


    Thanks again

  • Two questions about Windows Services