本机消息主机在打开Chrome时不会启动 [英] Native messaging host not starting when opening Chrome

查看:1135
本文介绍了本机消息主机在打开Chrome时不会启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个页面动作扩展,它将与本地消息传递主机(即EXE文件)进行通信。



我已经安装了我的扩展程序,我看到它的用户界面按预期工作,但EXE没有启动。
我需要自己做一些事情才能从中脱颖而出吗? :

  port = chrome.runtime.connectNative(hostName); 

我已经在注册表中安装了主机,如下所示:

  Windows注册表编辑器版本5.00 

[HKEY_LOCAL_MACHINE \SOFTWARE\Google\Chrome\NativeMessagingHosts\.com.google.chrome.example .echo] @ =C:\Users\me\Desktop\\\
ativeMessaging\host\com.google.chrome.example.echo-win.json

(我也手动添加了这个,因为x86和x64位版本配置文件似乎有些乱七八糟......)



主机清单文件:

  {
name:com.google .chrome.example.echo,
description:Chrome原生消息API示例主机,
路径:native-messaging-example-host.bat,
键入:stdio,
allowed_origins:[
chrome-extension:// knldjmfmopnpolahpmmgbagdohdnhkik /,
*
]
}

里面 native-messaging-example-host.bat 我有:

  MyExeName.exe 

正如您所看到的,我在 allowed_origins中添加了* JUST IN CASE其他选项不适用于页面操作。



我也尝试将EXE名称直接放在清单文件中,但仍然没有运气。



我仍然得到:

 未找到指定的本机通讯主机。 

我也会用ProccessExplorer检查Chrome浏览器加载的应用程序,以防它被加载,但我这些奇怪的事情是,我已经开始修改谷歌的本地消息主机示例,我认为它是作为一个应用程序工作的。当我将它变成页面动作扩展时,它停止了工作。



有人知道这里有什么问题吗?

解决方案

我有类似的问题。启用日志记录没有帮助。原来是在我的注册表键:



[HKEY_LOCAL_MACHINE \SOFTWARE\Google\Chrome\NativeMessagingHosts



我引用了EXE和路径,例如C:\Temp\Chrome\ChromeNativeApp.exe与C:\Temp\Chrome\ChromeNativeApp.exe


I am trying to make a page-action extension that will communicate with a native messaging host (that is an EXE file).

I have installed my extension and I see its UI working as expected, but the EXE is not started. Do I need to do something myself to start it apart from that? :

port = chrome.runtime.connectNative(hostName);

I have installed the host in the registry like so:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts\com.google.chrome.example.echo] @="C:\Users\me\Desktop\nativeMessaging\host\com.google.chrome.example.echo-win.json"

(I have also added this manually because there seemed to be a mess with the x86 and x64 bit version hives...)

Host Manifest file:

{
  "name": "com.google.chrome.example.echo",
  "description": "Chrome Native Messaging API Example Host",
  "path": "native-messaging-example-host.bat",
  "type": "stdio",
  "allowed_origins": [
    "chrome-extension://knldjmfmopnpolahpmmgbagdohdnhkik/",
    "*"
  ]
}

Inside native-messaging-example-host.bat I have the :

MyExeName.exe

As you can see, I have added a "*" in allowed_origins JUST IN CASE the other option was not right for page actions.

I have also tried to put the EXE name directly inside the manifest file, but again with no luck.

I still get a :

Specified native messaging host not found. 

I also check with ProccessExplorer to see what apps Chrome loads, just in case it gets loaded, but I don't see it there either.

The weird things is that I have started modifying the native messaging host sample from Google and I think it was working as an app. It stopped working when I turned it into a page action extension.

Does anyone have any idea what is wrong here?

解决方案

I had a similar issue. Enabling logging did not help. Turned out to be in my registry key:

[HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts

I had quotes around the EXE and path, e.g. "C:\Temp\Chrome\ChromeNativeApp.exe" vs. C:\Temp\Chrome\ChromeNativeApp.exe

这篇关于本机消息主机在打开Chrome时不会启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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