0

I have created a window service and set some dependencies like on MSMQ, MSSQLSERVER and so. Everything is working nice. but i need to send another dependency for my service. That is on internet connection. My service is responsible for sending emails. As soon my server starts, my service starts too and it finds if there is anything to send, if there is, it starts to send email, if during sending it is not able to connect to the internet it cannot send email.

so i guess i should set my service dependency on internet connection too. I already set my window service dependency to MicrosoftSQL Server and Microsoft Message Queuing by editing the registry value.

by adding new multi string value named "DependOnService", Type "REG_MULTI_SZ" and space separated names of the services that my service depends upon for the Data.

For Microsoft SQL Server i set the value to "MSSQLSERVER" but i don't know the name of the internet service that i need to set dependency upon.

how can i do this, any help please Thanks

2 Answers2

1

This shouldn't have been migrated because the solution is programmatic. Have your service test the Internet connectivity before trying to send the messages. If there's no connection (e.g. ping an IP address that can be relied on to be there, such as your ISP's gateway), sleep for a bit and try again.

John Gardeniers
  • 27,458
  • 12
  • 55
  • 109
0

I'm having this same issue with a windows service where the service expects to listen on an IP address that hadn't been readied yet. I added a dependency to Netman (Network Connections) and also to SQL Server (which the service also depends on). Rather than muck with the registry, I used the command line, as such:

sc \\YOURSERVERNAME config YOURSERVICENAME depend= NETMAN/MSSQLSERVER

Be sure to replace your server name and your service name. If successful, you should see:

[SC] ChangeServiceConfig SUCCESS

I'm waiting to confirm this works until the next weekly reboot, but it should!

Mike L
  • 338
  • 1
  • 2
  • 9