Windows Services and PTVS

Jul 9, 2013 at 7:42 PM
I've created numerous Windows Services using C#, but hoping to transition to writing Windows Services in CPython using PTVS (* not IronPython). I'm having a tough time digging up samples of how to get started. Does anyone recommend any resources or books to help get off the ground developing Windows Services using CPython and PTVS?
Jul 9, 2013 at 8:10 PM
I found some examples of how to use win32serviceutil to create a service, however, at this point I'm wondering how I get PTVS to recognize/import win32serviceutil. I'm just chugging along here, any assistance - no matter how small - would be greatly appreciated.
Jul 9, 2013 at 9:43 PM
Once you've installed the win32serviceutil package, you'll need to refresh the database (see this page about getting to the Python Interpreters window). Once that's done, it should show up in PTVS.

If it doesn't show up, but you can run a script that imports it, we may have another issue.
Jul 10, 2013 at 11:23 AM
Refreshed the database, but had to restart Visual Studio to finally see win32serviceutil. Thank you Zooba! Hopefully blue skies from here on out...
Jul 10, 2013 at 12:41 PM
Everything seems fine in VS, but when I debug, I get - No module named 'win32service'
Jul 10, 2013 at 1:29 PM
Question: Using PTVS, if I want to debug a service, do I first install it, and then attach to it? Or can I run it straight from within VS? I'm guessing that it is the former, but can't find any specific documentation.
Jul 10, 2013 at 2:30 PM
I'm beginning to think I'm the only one trying to do this (time to go back to C#?)
Jul 10, 2013 at 3:13 PM
It's entirely likely that nobody has done it with PTVS before. There seems to be some general help on StackOverflow, but debugging may be difficult since the whole point of a service is that it is not started normally.

Have a look at our Remote Debugging feature and see if that can help you. You'll be able to install and then attach to the service, even if it's on another machine or running as a different user. (Just make sure you remove the debugging hook before you release your code or you've got a major security hole.)
Jul 22, 2013 at 2:45 PM
Well, some good news, I was able to use PTVS to develop a Windows service with win32 apis and the twisted framework.

This link was especially helpful:

Now onto debugging...