1

I have been trying to get speech recognition working from a Windows Service without much luck. I am able to get it working just fine from a Console, winForms or WPF application, but when I try to put the same code into a Service. I based my sample console app on the example here: http://msdn.microsoft.com/en-us/library/ms554584.aspx Then I literally copied the same code to the service and it fails. I did read somewhere that the account that the Services run in don't have a access to a default audio device, so the problem lies with this line:

recognizer.SetInputToDefaultAudioDevice();

Is there some way I can get speech recognition from a microphone working from within a service?

Brian
  • 1,397
  • 9
  • 33
  • 51
  • 1
    Windows services are non interactive. What exactly are you trying to do here? – Oded Dec 14 '11 at 19:36
  • 1
    [It looks like somebody else already ran into this, and shares a workaround.][1] [1]: http://stackoverflow.com/questions/2369521/speechhypothesized-event-not-raised – G_P Dec 14 '11 at 19:38
  • @Oded - This is for a home automation system that runs as a windows service. I am trying to add voice recognition. – Brian Dec 14 '11 at 19:45
  • @G_P - Thanks, but in that question he never really solved it. His answer was to just call a console application to do the speech recognition. – Brian Dec 14 '11 at 19:47
  • Also related https://stackoverflow.com/questions/10377673/speech-recognition-engine-not-firing-event-in-windows-service – Nikolay Shmyrev Jun 27 '17 at 16:50

1 Answers1

1

It is probably a permissions problem. Run "services.msc", double-click on your service to edit it, and specify an account on the Log On tab. Use the account where you are able to run successfully as a console application.

CoreTech
  • 2,345
  • 2
  • 17
  • 24