Using Microsoft.Bing.Speech nuget Package and Net Framework 4.6.1 我在调用 RecognizeAsync(( 时遇到此异常
无法加载文件或程序集 'Bond.IO, 版本=1.0.0.0, 区域性=中性,公钥令牌=31bf3856ad364e35'或其之一 依赖。找到的程序集的清单定义没有 匹配程序集引用。(HRESULT的例外:0x80131040(
我的代码:
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 中安装不同的版本并更改版本号,但我无法使其工作。
有什么想法吗?
它对我有用,将Bond.Core.CSharp包更改为4.2.0