local version cannot run as service

Discussions about using SIP Sorcery on your own computer/server
kzqc
Posts: 9
Joined: Mon Mar 08, 2010 5:15 am

local version cannot run as service

Post by kzqc » Mon Mar 08, 2010 2:50 pm

Hi, I just installed the official 1.2 release yesterday. Followed the installation guide and customized xml file for the ip address and domain. When running in command line mode, everything is OK. I was able to create subaccount, add sipgate provider, dialplans, and am able to make and receive GV calls.

However, when I tried to run it as service, it would fail. I did the httpcfg set urlacl command, the return result was 0 - successful. I also double checked it later with httpcfg query urlacl, the result is good (see below). installutil finished ok also, the install log seems fine. But when the service is started, it would end in a few minute, with a system event error
.Net 2.0 Runtime Error Reporting
EventType clr20r3, P1 sipsorcery-appsvr.exe, P2 1.0.0.14617, P3 4b726933, P4 sipsorcery-appsvr, P5 1.0.0.14617, P6 4b726933, P7 4f, P8 aeb, P9 system.unauthorizedaccess, P10 NIL.

It seems it is related to unauthorized accesss.

There is nothing in the logs\error.log at all.

My system is WinXP SP3, with latest updates, and all .Net latest updates also.

Can someone please help? Thanks.


C:\Program Files\sipsorcery>httpcfg query urlacl
URL : http://*:2869/
ACL : D:(A;;GX;;;LS)
------------------------------------------------------------------------------
URL : http://+:10243/WMCv2/
ACL : D:(A;OICI;KA;;;NS)
------------------------------------------------------------------------------
URL : http://+:10243/WMPNSSv3/
ACL : D:(A;OICI;KA;;;NS)
------------------------------------------------------------------------------
URL : http://+:80/Temporary_Listen_Addresses/
ACL : D:(A;;GX;;;WD)
------------------------------------------------------------------------------
URL : http://+:8080/
ACL : D:(A;;GX;;;LS)
------------------------------------------------------------------------------

StephenWRogers
Posts: 4
Joined: Sat Mar 06, 2010 8:03 pm

Post by StephenWRogers » Mon Mar 08, 2010 4:32 pm

Hi,

Same issue here, but on Win 2008. Running as command line version works fine, but installed service stops unexpectedly after a minute or so. I can't see any errors logged.

Have registered namespace reservation successfully for Local Service account with

netsh http add urlacl url=http://+:8080/ user="NT Authority\Local Service"


Reserved URL : http://+:8080/
User: NT AUTHORITY\LOCAL SERVICE
Listen: Yes
Delegate: No
SDDL: D:(A;;GX;;;LS)


Stephen

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Post by Aaron » Mon Mar 08, 2010 11:57 pm

Something should definitely be showing up in the log files.

One thing that will prevent that is if the user the service is running under doesn't have permissions to ovewrrite any existing log files. Before starting the service delete all the files in the sipsorcery log directory.

The only thing that stops the service being able to start at all is a malformed configuration file. But if you can start the application as a console then that's not an issue since the service and console modes both use the same file.

The reservation of the HTTP namespaces will cause issues for the operation of the sipsorcery application but won't stop it starting up and will result in a warning message being written to the log file.

Regards,

Aaron

StephenWRogers
Posts: 4
Joined: Sat Mar 06, 2010 8:03 pm

Post by StephenWRogers » Tue Mar 09, 2010 10:08 am

Hi,

I fixed the log permissions problems and found the error - the PersistenceConnStr value was just "xmlconfig" which worked fine when running as a console, but when running as a service this eventually results in an error like cannot find "c:\windows\system32\xmlconfig"

I'm not sure why though, as far as I can see the connection string gets prepended with AppDomain.CurrentDomain.BaseDirectory which I thought should point to the right place.

Thanks,

Stephen

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Post by Aaron » Tue Mar 09, 2010 10:24 am

Hi Stephen,

I found that issue as well. When I was testing I had my windows service working correctly with just xmlconfig and AppDomain.CurrentDomain.BaseDirectory. I obviously missed something and will revisit it at some point. The simple fix is to fully qualify the direcrtory and file paths in the sipsorcery-appsvr.exe.config file.

Regards,

Aaron

kzqc
Posts: 9
Joined: Mon Mar 08, 2010 5:15 am

fixed. but new problem come up

Post by kzqc » Tue Mar 09, 2010 5:32 pm

Thanks. I changed xmlconfig to absolute path as following:
<add key="PersistenceConnStr" value="C:\Program Files\sipsorcery\xmlconfig" />

also added permission to folder C:\Program Files\sipsorcery\ for LocalService. It worked and the service can start. Just tested an outgoing call, and it works.

But there is one new error in error.log:

2010-03-09 11:01:28,770 [5] ERROR sipsorcery [(null)] - Exception SSHServerDaemon Start. ComponentActivator: could not instantiate NSsh.Server.NSshService

any idea?

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Post by Aaron » Tue Mar 09, 2010 10:56 pm

I haven't seen that error before. It would be worth checking in your add/remove programs that you have .Net 3.5 Service pack 1.

Are you planning on using the SSH access to your local sipsorcery instance? If not you can comment out the nssh node in your confiug file which will disable it and remove the error message.

Regards,

Aaron

kzqc
Posts: 9
Joined: Mon Mar 08, 2010 5:15 am

Post by kzqc » Wed Mar 10, 2010 1:29 am

Thanks. I do have all the latest .net updates, including 3.5 sp1.

Anyway, I don't use ssh, so it should not affect my use. I will leave it there for now.

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Post by Aaron » Wed Mar 10, 2010 1:51 am

Actually it's probably the same issue as the xmlconfig directory. The SSH component needs to use a file called NSshConfiguration.xml and if running as a service the path to it will need to be fully qualified in the config file.

It won't cause any harm if you aren't using ssh.

Regards,

Aaron

kzqc
Posts: 9
Joined: Mon Mar 08, 2010 5:15 am

It already tried that, did not work

Post by kzqc » Thu Mar 11, 2010 6:02 pm

Actually I tried that before I posted, it did not work.

Post Reply