C#WPF无法将类型为“System.__ComObject”的 COM 对象强制转换为接口类型“System.Speech.Internal.SapiInterop.ISpDataKey”。解决办法

 this.speecher.SpeakAsync(textToSpeak); // 报错

无法将类型为“System.__ComObject”的 COM 对象强制转换为接口类型“System.Speech.Internal.SapiInterop.ISpDataKey”。此操作失败的原因是对 IID 为“{14056581-E16C-11D2-BB90-00C04F8EE6C0}”的接口的 COM 组件调用 QueryInterface 因以下错误而失败: 不支持此接口 (异常来自 HRESULT:0x80004002 (E_NOINTERFACE))。

 故障信息
===================================

无法将类型为“System.__ComObject”的 COM 对象强制转换为接口类型“Microsoft.VisualStudio.OLE.Interop.IServiceProvider”。此操作失败的原因是对 IID 为“{6D5140C1-7436-11CE-8034-00AA006009FA}”的接口的 COM 组件调用 QueryInterface 因以下错误而失败: 不支持此接口 (异常来自 HRESULT:0x80004002 (E_NOINTERFACE))。 (Microsoft.VisualStudio.OLE.Interop)

------------------------------
程序位置:

   在 Microsoft.VisualStudio.OLE.Interop.IServiceProvider.QueryService(Guid& guidService, Guid& riid, IntPtr& ppvObject)
   在 Microsoft.VisualStudio.Shell.ServiceProvider.GetService(Guid guid, Type serviceType)
   在 Microsoft.VisualStudio.Shell.ServiceProvider.GetService(Type serviceType)
   在 Microsoft.VisualStudio.Shell.WindowPane.GetService(Type serviceType)
   在 Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerToolWindow.GetService(Type serviceType)
   在 Microsoft.VisualStudio.Shell.WindowPane.System.IServiceProvider.GetService(Type serviceType)
   在 System.ComponentModel.Design.ServiceContainer.GetService(Type serviceType)
   在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorerControl.GetService(Type serviceType)
   在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorerControl.System.IServiceProvider.GetService(Type serviceType)
   在 System.ComponentModel.Design.ServiceContainer.GetService(Type serviceType)
   在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItem.GetService(Type serviceType)
   在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.RootNavigableItem.GetService(Type serviceType)
   在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NodeContext.GetService(Type serviceType)
   在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.<GetColumnsFromNavigationService>d__f.MoveNext()
   在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.AddFields(List`1 list, IEnumerable`1 fields, IDictionary`2 allValidFields, AddFieldsFlags flags)
   在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.GetFields(INodeInformation source, Dictionary`2& allValidColumns)
   在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.BuildDynamicItemWithQuery(IList`1 nodes, INodeInformation source, INavigableItem sourceItem, String urnQuery, Boolean registerBuilder, Boolean registerBuiltItems)
   在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.BuildDynamicItem(IList`1 nodes, INodeInformation source, INavigableItem sourceItem, IFilterProvider filter)
   在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.Build(IList`1 nodes, INodeInformation source, INavigableItem sourceItem, IFilterProvider filter)
   在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItem.RequestChildren(IGetChildrenRequest request)
   在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ExplorerHierarchyNode.BuildChildren(WaitHandle quitEvent)

解决方法 1:

试一下执行:

32 bit (32位机)
regsvr32 "C:\Program Files\Internet Explorer\ieproxy.dll"

64 bit(64位机)
regsvr32 "C:\Program Files (x86)\Internet Explorer\ieproxy.dll"

如果不行,请再执行
C:\windows\system32\regsvr32.exe /u actxprxy.dll

regsvr32是WINDOWS系统的一个程序,用来配置DLL动态链接库文件。
它有多个参数。
用法:regsvr32 [/u][/s][/n][/i[:cmdline]] dllname
/u- 解除服务器注册
/s- 无声,不显示提示消息框
/i- 调用dllInstall,给其传递一个可选[cmdline],跟/u一起使用时,删除dll
/n-不要调用DllRegisterServer,这个选项必须和/i一起使用

例如:
regsvr32 /u shmedia.dll是用来解除shmedia.dll文件的注册,用来解决无法正常删除RMVB视频文件。
系统或软件在调用任何一个dll文件的时候都必须先注册。


 

 

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值