NetTalk Central

Author Topic: NTWS app fails as service with MSSQL  (Read 7918 times)

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
NTWS app fails as service with MSSQL
« on: February 08, 2013, 01:00:00 PM »
I have a NTWS 6.51 site running as a service with selfservice.
This has been running for years but recently had to make some changes and so upgraded it to C8 and NTWS 6.51.
Now the silly thing won't let anyone get to the data. This includes loggin in. It just seems to ignore the SQL connect string.
If I kill the service and run it as a window, it seems to work. Not at the client's location however. and that is not a workable solution.
So we made a manager app for it to start and stop the service.
If we Start the service from the manager, it works perfectly. BUT if we reboot the machine and allow it to start by itself (it is set to automatic), the site doesn't work.
At that point, we can start the manager, stop the service, wait a minute and restart it from the manager, it works fine.

Can anyone see a possible solution? What am I missing?

On a side note, WHY does self service install the service as 2x the automatic byte instead of the selected constant?

Thanks,
Chris C
Real programmers use copy con newapp.exe

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: NTWS app fails as service with MSSQL
« Reply #1 on: February 08, 2013, 08:28:24 PM »
Hi Chris,

Question: Are you also using FM3?

I ran into something a while back (not using FM3 anymore, so don't have the code handy) where I had to redo the SQL Connect string in the FMConnect window, because at some stage of the service starting, it got screwed up.
Cheers,

Stu Andrews

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: NTWS app fails as service with MSSQL
« Reply #2 on: February 08, 2013, 08:42:18 PM »
Thanks, Stu.

With TPS I always have FM3, so I had to check. This is MSSQL and not my database so no FM3 here.

This is so flaky it is driving me nuts and looks really bad to the client.

Chris
Real programmers use copy con newapp.exe

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NTWS app fails as service with MSSQL
« Reply #3 on: February 08, 2013, 10:45:32 PM »
Hi Chris,

because your service is using MsSql, and I'm guessing running on the same machine as the Sql Server, you need to "tell" the service manager that MsSql needs to complete starting before your service can be started.

Run
Services.Msc
Find your service
Right-click Properties
then look around for dependencies, and make sure MsSql is set as a dependency.

Cheers
Bruce

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: NTWS app fails as service with MSSQL
« Reply #4 on: February 09, 2013, 04:51:54 AM »
Thanks, I'll try that. However, this happens even over a network connection to an already running SQL server as well.

Chris
Real programmers use copy con newapp.exe

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: NTWS app fails as service with MSSQL
« Reply #5 on: February 09, 2013, 05:20:26 AM »
Brilliant as usual, Bruce, brilliant.

for anyone else making services on SQLserver or dependent on other services, here is the cmd to add a dependency to a service.

sc config NTWS depend= MSSQL$mysqlservice

The failure issue on a network connection was the lack of windows authentication on the SQLserver so that really was a red herring.

many thanks, Bruce!

Chris
Real programmers use copy con newapp.exe

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: NTWS app fails as service with MSSQL
« Reply #6 on: February 10, 2013, 06:31:00 PM »
Wow. This has been bugging me for a couple of years now .. Fantastic stuff!
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NTWS app fails as service with MSSQL
« Reply #7 on: February 10, 2013, 09:46:51 PM »
hi Chris,

>> On a side note, WHY does self service install the service as 2x the automatic byte instead of the selected constant?

I'm not sure what you mean by this line - can you explain more please?

cheers
Bruce

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: NTWS app fails as service with MSSQL
« Reply #8 on: February 11, 2013, 08:36:09 AM »
Hey there, Bruce.

Here's what we wanted to do - Install the service as Manual start or On_Demand
You have -
SS_SERVICE_BOOT_START           equate(00000000h)
SS_SERVICE_SYSTEM_START         equate(00000001h)
SS_SERVICE_AUTO_START           equate(00000002h)
SS_SERVICE_DEMAND_START         equate(00000003h)
SS_SERVICE_DISABLED             equate(00000004h)

Very Nice!

And we had  self.Automatic which is set to 1
So set it to 0 and off you go, right? . . . Nope. 'cause then instead of automatic, you get a different kind of automatic - BOOT_START
That's because CreateService Routine has this -   
(SS_SERVICE_AUTO_START * self.Automatic)
as the start type.

I know I said *2 in my message, but really the problem is *self.Automatic.

We did find out that if we set self.Automatic to 2 we could install the service as Disabled... but that didn't quite fit either.

What I'd like to see (and almost changed the class, etc) is self.StartType where we can set it to any of the start type equates.

Thanks for asking,

Chris C
Real programmers use copy con newapp.exe

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NTWS app fails as service with MSSQL
« Reply #9 on: February 12, 2013, 01:49:35 AM »
good idea. done.

cheers
Bruce

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: NTWS app fails as service with MSSQL
« Reply #10 on: February 12, 2013, 02:01:39 PM »
Cool.
Thanks.
Real programmers use copy con newapp.exe