Chrome扩展程序本地消息传递出现错误:“未找到指定的本地消息传递主机”。 [英] Chrome extension native messaging got error:"Specified native messaging host not found."

查看:1476
本文介绍了Chrome扩展程序本地消息传递出现错误:“未找到指定的本地消息传递主机”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的平台操作系统是win 7.
我开始编写扩展并尝试与C ++应用程序通信。
这里是我的应用程序清单:(xxx是我的扩展名)

  {
name :com.google.chrome.testc,
path:D:\\testC\\debug\\testC.exe,
description:我的应用程序,
type:stdio,
allowed_origins:[
chrome-extension:// xxx /
]
}

我还在以下位置添加了注册表项:HKEY_LOCAL_MACHINE \SOFTWARE\Google\Chrome\NativeMessagingHosts: com.google.chrome.testc:D:\testC\debug\manifest.json



但是当扩展名为chrome.runtime.sendNativeMessage(' com.google.chrome.testc',...),它总是报告指定的本地消息主机未找到。。

我错过了什么步骤?或上面有什么不对?
Thanks。

解决方案

注册表项应该是 HKEY_LOCAL_MACHINE \SOFTWARE\Google\\ \\ Chrome \NativeMessagingHosts\com.my_company.my_application ,它是(默认)值应该是 D:\\ \\ testC \debug\manifest.json



从您的描述中可以看出,您正在添加名称 com.my_company.my_application 下的键 HKEY_LOCAL_MACHINE \SOFTWARE\Google\Chrome\NativeMessagingHosts


My platform OS is win 7. I started to write extension and try to communicate with C++ app. Here is manifest of my app: (xxx is my extension id)

{
  "name": "com.google.chrome.testc",
  "path": "D:\\testC\\debug\\testC.exe",
  "description": "My Application",
  "type": "stdio",
  "allowed_origins": [
  "chrome-extension://xxx/"
  ]
}

And I also add registry key at: HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts: "com.google.chrome.testc: D:\testC\debug\manifest.json"

But when extension called "chrome.runtime.sendNativeMessage('com.google.chrome.testc', ...)", it always report "Specified native messaging host not found.".

What step I missed? or something wrong above? Thanks.

解决方案

The registry key should be HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts\com.my_company.my_application, and it's (Default) value should be D:\testC\debug\manifest.json.

From your description it seems that you are instead adding a string value with name com.my_company.my_application under the key HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts

这篇关于Chrome扩展程序本地消息传递出现错误:“未找到指定的本地消息传递主机”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆