我在 .Net Core 3.1 中创建了一个 Web API,它使用System.Speech
- 在 .Net Core Nuget Package here上运行,但是当我的 API 使用该库时出现 500 错误。
错误内容如下:
Connection id "0HMFHNV7NFO0R", Request id "0HMFHNV7NFO0R:00000010": An unhandled exception was thrown by the application.
System.UnauthorizedAccessException: Access is denied. (0x80070005 (E_ACCESSDENIED))
at System.Speech.Internal.SapiInterop.ISpRecognizer.SetRecognizer(ISpObjectToken pRecognizer)
...
at <Referenced project & method> in
C:\Users\<username>\...\...\....cs:line 23
我假设这与对 System.Speech 的引用无关,但我的托管服务提供商说:
如果您在 .net Web 应用程序中使用 System.Speech,则需要 LocalSystem of Application Pool Identity。我没有更好的解决方案,也许您可以尝试另一个可以单独为您的项目工作的语音库。
这是合乎逻辑的,还是因为它是一个 .Net Core 包,它是完全独立的并且不需要它?
而且,更重要的是,有什么方法可以修复以继续使用这个库吗?
有关更多背景信息,请参阅我在此处发布的其他问题。