通过 IIS 运行 Microsoft.Speech?
我有一个使用 Microsoft.Speech 来识别 WAV 文件中的语音的应用程序。当作为控制台应用程序在本地运行时它可以完美运行,但当由 IIS 执行时会出现错误。
假设我在带有 .NET 3.5+ 的 WinServer 2008 上安装了以下软件:
- Microsoft 语音平台 - 软件开发工具包 (SDK)(版本 10.1)
- Microsoft 语音平台 - 服务器运行时语言(版本 10.1)
- Microsoft 语音平台 - 软件开发工具包 (SDK) (版本 10.1)
是否可以通过 IIS7 使用 Microsoft.Speech?我在这里缺少什么?
我尝试将其重新编码为 ASP.NET Web 服务,但这也不起作用。
Suuuuper被困在这里。如果您能提供帮助,谢谢:)拜托了:)
更新: 这是错误消息+堆栈跟踪:
System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at Microsoft.Speech.Internal.SapiInterop.ISpRecognizer.CreateRecoContext(ISpRecoContext& ppNewCtxt)
at Microsoft.Speech.Internal.SapiInterop.SapiRecognizer.<>c__DisplayClass17.b__16()
at Microsoft.Speech.Internal.SapiInterop.SapiProxy.PassThrough.Invoke(ObjectDelegate pfn)
at Microsoft.Speech.Internal.SapiInterop.SapiRecognizer.CreateRecoContext()
at Microsoft.Speech.Recognition.RecognizerBase.Initialize(SapiRecognizer recognizer, Boolean inproc)
at Microsoft.Speech.Recognition.SpeechRecognitionEngine.get_RecoBase()
at Microsoft.Speech.Recognition.SpeechRecognitionEngine.Initialize(RecognizerInfo recognizerInfo)
at Microsoft.Speech.Recognition.SpeechRecognitionEngine..ctor()
at myRecognize.Recognize..cctor() The type initializer for 'myRecognize.Recognize' threw an exception. myRecognize
at myRecognize.Recognize.get_Reco()
at myRecognize.Recognize.Listen(String wavLoc, String grammars)
I have an app that uses Microsoft.Speech to recognize speech in a WAV file. It works perfectly when run locally as a console app but barfs when executed by IIS.
Assuming I have the following installed on WinServer 2008 with .NET 3.5+:
- Microsoft Speech Platform - Software Development Kit (SDK) (Version 10.1)
- Microsoft Speech Platform - Server Runtime Languages (Version 10.1)
- Microsoft Speech Platform - Software Development Kit (SDK) (Version 10.1)
Is it even possible to use Microsoft.Speech over IIS7? What am I missing here?
I've tried re-coding it as an ASP.NET web service but that doesn't work either.
Suuuuper stuck here. Thanks if you can help :) Pretty please :)
UPDATE:
Here's the error message + stack trace:
System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at Microsoft.Speech.Internal.SapiInterop.ISpRecognizer.CreateRecoContext(ISpRecoContext& ppNewCtxt)
at Microsoft.Speech.Internal.SapiInterop.SapiRecognizer.<>c__DisplayClass17.b__16()
at Microsoft.Speech.Internal.SapiInterop.SapiProxy.PassThrough.Invoke(ObjectDelegate pfn)
at Microsoft.Speech.Internal.SapiInterop.SapiRecognizer.CreateRecoContext()
at Microsoft.Speech.Recognition.RecognizerBase.Initialize(SapiRecognizer recognizer, Boolean inproc)
at Microsoft.Speech.Recognition.SpeechRecognitionEngine.get_RecoBase()
at Microsoft.Speech.Recognition.SpeechRecognitionEngine.Initialize(RecognizerInfo recognizerInfo)
at Microsoft.Speech.Recognition.SpeechRecognitionEngine..ctor()
at myRecognize.Recognize..cctor() The type initializer for 'myRecognize.Recognize' threw an exception. myRecognize
at myRecognize.Recognize.get_Reco()
at myRecognize.Recognize.Listen(String wavLoc, String grammars)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在黑暗中拍摄:它尝试从磁盘加载一些文件,但失败了,这些文件来自 IIS 应用程序池用户无权读取的区域。
尝试运行 sysinternals ProcessMon 找出哪个,然后授予应用程序池用户(或本地组 IIS_IUSRS,如果您尚未更改应用程序池用户)对该目录的权限。
Shot in the dark: it's trying and failing to load some files from disk, from an area the IIS app pool user doesn't have permission to read.
Try running sysinternals ProcessMon to find out which, then grant the app pool user (or local group IIS_IUSRS if you haven't changed the app pool user) permissions to that directory.
简单修复:为运行应用程序池的同一用户授予对
C:\windows\system32\config\systemprofile\appdata\roaming
的读/写访问权限。Simple fix: Grant read/write access to
C:\windows\system32\config\systemprofile\appdata\roaming
for the same user that the app pool is running under.