未注册的类(HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

时间:2022-09-01 07:46:27

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Microsoft.Speech.dll

类型“System.Runtime.InteropServices”的未处理异常。发生在Microsoft.Speech.dll COMException”

Additional information: Retrieving the COM class factory for component with CLSID {49428A60-C997-4D0E-9808-9E326C178D58} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

附加信息:使用CLSID {49428A60-C997-4D0E-9808-9E326C178D58}来检索COM类工厂失败,因为以下错误:80040154类未注册(HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))。

I am following this sample from MSDN for Microsoft Speech Platform SDK 11:

以下是MSDN对微软语音平台SDK 11的示例:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using Microsoft.Speech;
using Microsoft.Speech.Recognition;
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            SpeechRecognitionEngine sre = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-US"));                        ======>>**ERROR** 
            sre.SetInputToWaveFile(@"c:\Test\Colors.wav");
            Choices colors = new Choices();
            colors.Add(new string[] { "red", "green", "blue" });

            GrammarBuilder gb = new GrammarBuilder();
            gb.Append(colors);

            Grammar g = new Grammar(gb);
            sre.LoadGrammar(g);

            // Register a handler for the SpeechRecognized event.
            sre.SpeechRecognized +=
              new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);

            // Start recognition.
            sre.Recognize();

            sre.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);

        }

        private void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            MessageBox.Show("Speech recognized: " + e.Result.Text);
        }


    }
}

2 个解决方案

#1


9  

Sounds like you only installed the 64-bit version of the Speech Platform Runtime, and not the 32-bit version.

听起来你只安装了语音平台运行时的64位版本,而不是32位版本。

#2


0  

In my case it helped to install the Microsoft Speech Platform Runtime as well. Although I already had the Speech SDK and the Kinect SDK installed.

在我的例子中,它也帮助安装了Microsoft语音平台运行时。虽然我已经安装了语音SDK和Kinect SDK。

#1


9  

Sounds like you only installed the 64-bit version of the Speech Platform Runtime, and not the 32-bit version.

听起来你只安装了语音平台运行时的64位版本,而不是32位版本。

#2


0  

In my case it helped to install the Microsoft Speech Platform Runtime as well. Although I already had the Speech SDK and the Kinect SDK installed.

在我的例子中,它也帮助安装了Microsoft语音平台运行时。虽然我已经安装了语音SDK和Kinect SDK。