WodVpn in windows service - WeOnlyDo Discussion board

WodVpn in windows service (General questions)

by qaiser, Monday, October 26, 2009, 14:30 (5506 days ago)

Hi,

I'm working on a solution where I use WodVpn in a windows service. WodVpn is set to search for peer with retryCount=0(forever) and retryWait=10000. The problem is when I check the logs on my server(my mediator) the wodvpn seems to only send the data to mediator once and when I try to connect to it, it fails.

If I reuse the exact same code in a console application the same thing happen but if I try it in a windows Forms(vb.net) application everything seems to work. Is there anything special I need to do when using it in windows service or console app?

Environment details.
OS=windows xp/vista/win7 (tried under all)
WodVpn=2.1.4.95
.net Framework=2.x

Qaiser.

Re: WodVpn in windows service

by wodDamir, Monday, October 26, 2009, 15:26 (5506 days ago) @ qaiser

Hi Qaiser,

What I believe the problem in your case is that the application ends immediately as it goes thru the code. Since it's a Console Application / Service, the application will run, and end as soon as all code is executed (that doesn't have to mean it actually finished). Nothing is actually *keeping* the Service running.

When using Forms Application, the code will run as long as Form is open.

To resolve this, I would suggest moving wodVPN into a separate thread, and use AutoResetEvent object to keep your service running.

Can you try something like that?

Regards,
Damba

Re: WodVpn in windows service

by qaiser, Monday, October 26, 2009, 15:40 (5506 days ago) @ wodDamir

Hi,

I'm sure am keeping the object alive and the app in both console and service.

In console app after initializing wodvpn object I call Console.Readline() so am sure the app is not dying and also wodvpn instance stays alive with it.

In windows service, I create the wodvpn as a class Instance and windows services don't exit unless you stop them so there is no problem of it dying.

Re: WodVpn in windows service

by wodDamir, Monday, October 26, 2009, 15:55 (5506 days ago) @ qaiser

Qaiser,

Is there any chance you could show us your code or send your application to techsupport@weonlydo.com ?

I need to see/duplicate the issue that you are experiencing if possible.

Regards,
Damba

Re: WodVpn in windows service

by qaiser, Monday, October 26, 2009, 16:11 (5506 days ago) @ wodDamir

Email you the sample project.