【问题标题】:Microsoft.CognitiveServices.Speech is not working after publishing applicationMicrosoft.CognitiveServices.Speech 在发布应用程序后不起作用
【发布时间】:2019-05-30 03:44:54
【问题描述】:

加载时出现以下异常:

speechRecognizer = new Microsoft.CognitiveServices.Speech.SpeechRecognizer(config);

内部异常:InnerException = {"无法加载 DLL 'Microsoft.CognitiveServices.Speech.csharp.bindings.dll': 找不到指定的模块。 (HRESULT 的例外情况: 0x8007007E)"}

Microsoft.CognitiveServices.Speech.Internal.carbon_csharpPINVOKE.SpeechConfig_FromSubscription(String jarg1,字符串 jarg2) 在 Microsoft.CognitiveServices.Speech.Internal.SpeechConfig.FromSubscription(字符串 订阅,字符串区域)在 Microsoft.CognitiveServices.Speech.SpeechConfig.FromSubscription(字符串 subscriptionKey, String region) |ERROR|类型初始化器 'SWIGExceptionHelper' 引发了异常。 2019-01-03 16:02:50.2178|错误|类型初始化器 'Microsoft.CognitiveServices.Speech.Internal.carbon_csharpPINVOKE' 抛出异常。

【问题讨论】:

  • 1.确保你已经安装了Microsoft.CognitiveServices.Speech 2。如果你正在使用DOTNET Core,当你运行dotnet publish 时,Microsoft.CognitiveServices.Speech.csharp.bindings.dll 应该被自动复制到publish/runtimes/<your-platform>/native/ 的目录中。 3. 如果您使用.NET Framework,则bindings.dll 位于\bin\x64\Debug\bin\x64\Release 文件夹中。
  • @itminus 非常感谢。现在工作正常。

标签: c# wpf wcf speech-recognition azure-cognitive-services


【解决方案1】:

正如例外所说,您缺少 "Microsoft.CognitiveServices.Speech.csharp.bindings.dll" 。您必须在项目中包含 dll 并将其标记为部署的一部分。确保它出现在 IIS 的已部署文件夹中,作为最后一个选项手动复制它。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-29
  • 2012-12-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多