本文介绍了无法加载文件或程序集Bond.IO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Microsoft.Bing.Speech nuget包和Net Framework 4.6.1调用RecognizeAsync()

Using Microsoft.Bing.Speech nuget package and Net Framework 4.6.1I'm having this exception when calling RecognizeAsync()

我的代码:

public static async Task SpeechToTextStreamPO(Stream audioStream, string textResult)
    {
        var subscriptionKey = ConfigurationManager.AppSettings["BingSpeechSubscriptionKey"];

        Uri ShortPhraseUrl = new Uri(@"wss://speech.platform.bing.com/api/service/recognition");
        Uri LongDictationUrl = new Uri(@"wss://speech.platform.bing.com/api/service/recognition/continuous");
        CancellationTokenSource cts = new CancellationTokenSource();

        var preferences = new Microsoft.Bing.Speech.Preferences("en-IN", ShortPhraseUrl, new CognitiveServicesAuthorizationProvider(subscriptionKey));

        // Create a a speech client
        using (var speechClient = new SpeechClient(preferences))
        {
            speechClient.SubscribeToRecognitionResult(async (recognitionResult) =>
            {
                if (recognitionResult.RecognitionStatus == Microsoft.Bing.Speech.RecognitionStatus.Success)
                {
                    textResult = recognitionResult.Phrases[0].DisplayText;
                }
            });

            var deviceMetadata = new DeviceMetadata(DeviceType.Near, DeviceFamily.Mobile, NetworkType.CellLTE, OsName.Android, "1607", "Dell", "T3600");
            var applicationMetadata = new ApplicationMetadata("SampleApp", "1.0.0");
            var requestMetadata = new RequestMetadata(Guid.NewGuid(), deviceMetadata, applicationMetadata, "SampleAppService");

            await speechClient.RecognizeAsync(new SpeechInput(audioStream, requestMetadata), cts.Token).ConfigureAwait(false);}
    }

我尝试在.csproj中安装不同的版本并更改版本号,但是我无法使其正常工作.

I've tried installing different versions and changing version numbers in .csproj but I can't make it work.

有什么想法吗?

推荐答案

它通过将Bond.Core.CSharp包更改为4.2.0为我工作.

it worked for me with changing Bond.Core.CSharp package to 4.2.0

这篇关于无法加载文件或程序集Bond.IO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 00:16