Could not load file or assembly Bond.IO

 ̄綄美尐妖づ 提交于 2019-12-10 21:03:55

问题


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

Could not load file or assembly 'Bond.IO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

My code:

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);}
    }

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

Any ideas?


回答1:


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



来源:https://stackoverflow.com/questions/50803039/could-not-load-file-or-assembly-bond-io

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!