简体   繁体   English

如何在Windows服务中使用SpeechRecognitionEngine?

[英]How do I use SpeechRecognitionEngine in a Windows Service?

I have been trying to get speech recognition working from a Windows Service without much luck. 我一直在尝试从Windows服务获得语音识别,但是运气不佳。 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. 我可以从Console,winForms或WPF应用程序中使它正常工作,但是当我尝试将相同的代码放入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. 我基于以下示例创建了示例控制台应用程序: http : //msdn.microsoft.com/zh-cn/library/ms554584.aspx然后,我从字面上将相同的代码复制到了该服务,但它失败了。 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? 我可以通过某种方式从服务内工作的麦克风获得语音识别吗?

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. 运行“ services.msc”,双击您的服务以对其进行编辑,然后在“登录”选项卡上指定一个帐户。 Use the account where you are able to run successfully as a console application. 使用您能够成功作为控制台应用程序运行的帐户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我如何阅读Windows服务的事件日志 - How do i read the eventlog of windows service 当我咳嗽......如何防止SpeechRecognitionEngine错误识别? - When I cough… How to prevent wrong recognition in SpeechRecognitionEngine? 如何创建用于身份验证的 Windows 服务,自定义 Web 应用程序可使用该服务对 AD 用户进行身份验证? - How do I create a windows service for authentication that custom web applications can use to authenticate AD users? 如何从服务内部退出Windows服务? - How do I quit a Windows service from inside the service? 我如何创建安装Windows服务以卸载然后安装服务? - how do i create the Setup windows service to uninstall then install service? 如何分发依赖于类库的 Windows 服务? - How do I distribute a Windows service that depends on a class library? 如何强制Windows Service同步运行而不是异步运行? - How do I force a Windows Service to run synchronously instead of asynchronously? 如何授予我的 Windows 服务管理员权限 - How do I give my windows service admin rights 如何将 SignalR 添加到 .NET Core Windows 服务? - How do I add SignalR to a .NET Core Windows Service? 如何从线程停止 windows 服务应用程序? - How do I stop a windows service application from a thread?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM