Chrome扩展程序本地消息传递出现错误:“未找到指定的本地消息传递主机”。 [英] Chrome extension native messaging got error:"Specified native messaging host not found."
问题描述
我的平台操作系统是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屋!