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:
我一直试图通过Windows服务获得语音识别而没有太多运气。我可以从控制台,winForms或WPF应用程序中使用它,但是当我尝试将相同的代码放入服务时。我在这里的示例基于我的示例控制台应用程序:http://msdn.microsoft.com/en-us/library/ms554584.aspx然后我真的将相同的代码复制到服务,它失败了。我确实读过服务运行的帐户无法访问默认音频设备的地方,所以问题出在这一行:
recognizer.SetInputToDefaultAudioDevice();
Is there some way I can get speech recognition from a microphone working from within a service?
有什么方法可以通过服务中的麦克风获得语音识别?
1 个解决方案
#1
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.
这可能是权限问题。运行“services.msc”,双击您的服务进行编辑,然后在“登录”选项卡上指定一个帐户。使用您能够成功运行的帐户作为控制台应用程序。
#1
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.
这可能是权限问题。运行“services.msc”,双击您的服务进行编辑,然后在“登录”选项卡上指定一个帐户。使用您能够成功运行的帐户作为控制台应用程序。