NetTalk Central

Author Topic: Webserver not responsive when run as service (SelfService)  (Read 6487 times)

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Webserver not responsive when run as service (SelfService)
« on: September 12, 2016, 06:15:50 PM »
Sorry to monopolize the forum but have yet another question:  I'm using SelfService to install my NTWS as a service.  It does indeed show up in services as running, etc.  But, it doesn't respond to any requests.  I've tried about every combination of settings that I can think of.

Thanks for any help.

Jim

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Webserver not responsive when run as service (SelfService)
« Reply #1 on: September 12, 2016, 07:23:17 PM »
Hi Jim,

presumably it works on the same machine if not a service?

The usual problem when running something as a service is it runs under a service account so you need to check if the service account has all the permissions it needs.

cheers,

Kevin

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Re: Webserver not responsive when run as service (SelfService)
« Reply #2 on: September 13, 2016, 02:49:18 AM »
Hi Kevin:  Yes, it runs fine as regular app.

Where do I check permissions for this? 

Thank you,

Jim

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Webserver not responsive when run as service (SelfService)
« Reply #3 on: September 13, 2016, 05:47:46 AM »
google is your friend.

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Webserver not responsive when run as service (SelfService)
« Reply #4 on: September 13, 2016, 06:24:43 PM »
Hi Jim,

I've run into this a bit, and it can be frustrating.

Basically, if the service needs to access printer drivers, or the nettalk->pdftools->pdf in browser (can't remember the reason, but it's set in my mind), then I add another windows account, log into it, make sure there's a default printer (doesn't have to exist physically, but the driver needs to be there, and defaulted). Once that's squared away, log back into the main account and set the service to run with the new windows account credentials (username/password).

However. I'm curious.

What do you mean by "doesn't respond to any requests" - Do you mean it's not actually serving when you use a browser to go to the url?

If so, a couple of things.

1. Make sure you have it serving fine in normal exe mode (which sounds like you have), visit it on a browser on the server itself to check locally.
2. Run as service, check both the url and also, if you're not already, try http://127.0.0.1:<port>, and http://localhost:<port>.
3. Make sure you have DebugView++ (or some debugview) running. Turn on as much logging as possible in the SelfService AND the Nettalk templates.
4. Recompile and run.
5. Watch the debug log for the starting of the service. Check any warnings / errors.
6. Then try visiting the url with the browser (locally). See what is being logged, check it, check it again :)

Hope that helps.
Cheers,

Stu Andrews

Poul

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Webserver not responsive when run as service (SelfService)
« Reply #5 on: September 15, 2016, 05:54:05 AM »
One technique i used to use years ago for trouble shooting terminal services but can be applied here,  generalizing Stu's tip.

Do not use a default Service account but one you control eg:NettalkSVSaccount, that you access

On your server, login with these credentials, and "emulate" what the Service is doing by going straight to the CMD prompt and simply try to Launch your NTserver as normal app,  eg YourNTApp,exe,  after you hit enter, thats pretty close to the state it would be if launched as a service.
remember your service can have no user interaction. (if your adminstrator runs something to tweak the users environment on login, you might want to check that, as, typically that's not applied to the service. Things affecting user profile, home directory, printers, shares etc)

so if it is not working then pay attention to everything you do to make it work, because this what it it needs as a service, you will learn for next time:)
( this is where you might see, that you are running from the wrong folder, missing a permission, PATH does not have something critical, or perhaps you prompt for something that as a service, it cannot respond to, firewall issues etc),  You have to make it so the app can simply launch.

d) Now set the service to use these credentials and try again.
you can then apply other  policies to the service account if you want.  or with the knowledge you have gained, you may now know how to
deploy for any other servers or service accounts.

HTH
poul

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Re: Webserver not responsive when run as service (SelfService)
« Reply #6 on: September 15, 2016, 11:59:17 AM »
Thanks Stu and Poul.  I appreciated your responses.

Turns out, it was a message that was causing it to halt.  And, the reason for that, it turns out, was that the embed point for setting the glo:filenames had to be moved down in the list (SelfService had a new embed point and I needed to do the assignment after that).  So, we're good to go there.

I'm saving both of your comments because I like the approach.  That makes a lot of sense and could have saved me a lot of frustration.  All part of the learning curve.

Best,

Jim

Poul

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Webserver not responsive when run as service (SelfService)
« Reply #7 on: September 16, 2016, 06:38:51 AM »
I use Messagebox from capesoft, to hook all the Clarion messages.
In NT i set it to auto respond to ALL messages  after a few seconds and I redirect the output to a log files as well.

Even in Application mode, That way  the server will never stop responding,  it might  slow down, if you have alot of messages,
 but a periodic review of the log will show whats been happening.

If you don't hook the messages, it can be very frustrating to have the server stop responding
as it waits for someone to click an ok buitton (Which never happens with the service)

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Re: Webserver not responsive when run as service (SelfService)
« Reply #8 on: September 17, 2016, 05:41:41 AM »
I agree.  Messagebox was key to finding the problem.  A must have!