Play wave file from a Windows Service (C#)

Playing a wav file from a service is definitely possible, at least on Windows 7 (and most likely Vista), by using the Windows Core Audio APIs. I recently verified this by making a small test service using NAudio. I just downloaded the NAudio sources and copied the “Wsapi” parts from their NAudioDemo project. This was on Windows 7 Enterprise 64bit, but I don’t think that matters. The service was using the LocalSystem account.
For the record, playing sounds from a service is a perfectly legitimate thing to do in an embedded setting.

Leave a Comment