部署在本地服务结构上的dotnet核心应用程序引发Microsoft语音服务异常

时间:2020-04-09 01:03:16

标签: .net-core azure-service-fabric azure-cognitive-services azure-speech

我有一个dotnet core 2.2应用程序,使用了Microsoft认知语音服务版本1.8.0。该应用程序部署在单节点本地服务结构群集上。

我使用Visual Studio 2019添加了服务结构支持 右键单击根项目->添加-> Container Orchestrator支持-> Service Fabric

成功部署后,当我点击控制器API时,会出现以下异常情况

> **System.DllNotFoundException: Unable to load DLL
> 'Microsoft.CognitiveServices.Speech.core.dll' or one of its
> dependencies: The specified module could not be found. (Exception from
> HRESULT: 0x8007007E)**    at
> Microsoft.CognitiveServices.Speech.Dialog.Internal.DialogServiceConfig.bot_framework_config_from_subscription(IntPtr&
> config, String subscription, String region)    at
> Microsoft.CognitiveServices.Speech.Dialog.BotFrameworkConfig.FromSubscription(String
> subscription, String region)    at
> WebApi.Controllers.MyController..ctor() in MyController.cs:line 71   
> at lambda_method(Closure , IServiceProvider , Object[] )    at
> Microsoft.AspNetCore.Mvc.Controllers.ControllerActivatorProvider.<>c__DisplayClass4_0.<CreateActivator>b__0(ControllerContext
> controllerContext)    at
> Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.<CreateControllerFactory>g__CreateController|0(ControllerContext
> controllerContext)    at
> Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State&
> next, Scope& scope, Object& state, Boolean& isCompleted)    at
> Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
> at
> Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
> at
> Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext
> context)    at
> Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next,
> Scope& scope, Object& state, Boolean& isCompleted)    at
> Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
> at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()   
> at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext
> httpContext)    at
> Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext
> httpContext)    at
> Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext
> httpContext)    at
> Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext
> context)    at
> Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext
> context)

我可以在dotnet核心应用程序中看到docker publish文件夹。发布文件夹具有 win-x86和win-x64运行时,其中包含本机 Microsoft.CognitiveServices.Speech.core.dll和Microsoft.CognitiveServices.Speech.extension.kws.dll

1 个答案:

答案 0 :(得分:0)

我能够解决here中所述的问题。

问题似乎出在VC ++运行时。这些dll是使用Microsoft Speech API所必需的,但默认情况下不会复制到容器中。因此,我更新了我的docker文件,将VC ++运行时dll复制到了容器中,并且工作正常。