The same template also works for VS 2010: just put this under
and the new template is under the C# / Wcf node:
Enjoy :) What's next? get this blog rss updates or register for mail updates!
Web Services Security, Interoperability and Performance - WCF, Axis2, WSIT, Node.js...
2 comments:
Thanks Yaron. Always useful posts!
What I found out to be very useful in case of self hosting is the capability to run the same code either as a console app or as a windows service. This allows for example to be able to debug without having to install the windows service and attach visual studio for debugging.
For that, some code is needed in the Main() of the ServiceBase class:
#if (!DEBUG)
System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new AdminConsoleWindowsService() };
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
#else
// Debug code: this allows the process to run as a non-service.
// It will kick off the service start point, but never kill it.
// Shut down the debugger to exit
AdminConsoleWindowsService service = new AdminConsoleWindowsService();
service.StartWCFService();
// Put a breakpoint on the following line to always catch
// your service when it has finished its work
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
#endif
This is from Lee Humphries: http://www.codeproject.com/KB/dotnet/DebugWinServices.aspx?fid=172874&df=90&mpp=10&noise=4&sort=Position&view=Expanded&fr=11
Cheers,
Olivier.
Olivier
This is a great idea. Usually I would create a service library and then have a separate executable to host it, but this is better.
Post a Comment