频道:MyChannel收到的发现错误:访问被拒绝无法评估交易:错误:DiscoveryService:MyChannel错误:访问被拒绝

发布于 2025-01-18 08:54:14 字数 771 浏览 1 评论 0原文

我在 ubuntu 上使用 Hyperledger Fabric 2.2。我正在尝试借助此 文章

我的结构网络和 apiserver.js 在同一服务器上。

  1. 这是否意味着我可以根据上述文章中给出的建议使用 localhost 而不是 Fabric 主机的 IP 地址。

如果我可以使用本地主机,则无需更改连接配置文件,对吗?

所以,我尝试使用命令 curl http://localost:8080/api/queryallcars 进行查询

,但出现错误curl: (7) 无法连接到本地主机端口 8080: 连接被拒绝

&错误:[DiscoveryService]:发送[mychannel] - 频道:mychannel 收到发现错误:访问被拒绝 无法评估事务:错误:DiscoveryService:mychannel 错误:访问被拒绝

另外,我在 apiserver.js 文件中启用了 discovery: {enabled: true, asLocalhost: true} 。

我哪里做错了?

先感谢您!

更新:@Jerome O'Mahony 给出的答案对我有用!

I am using Hyperledger fabric 2.2 on ubuntu. I am trying to create REST API using express.js with the help of this article.

My fabric network and apiserver.js is on same server.

  1. Does that mean that i can use localhost instead of the IP address of fabric host by the given suggestion in mentioned article.

if i can use local host there is no need to change connection profile right?

so, i tried to query using the command curl http://localost:8080/api/queryallcars

but i got errors curl: (7) Failed to connect to localhost port 8080: Connection refused

& error: [DiscoveryService]: send[mychannel] - Channel:mychannel received discovery error:access denied
Failed to evaluate transaction: Error: DiscoveryService: mychannel error: access denied

Also, I have enabled discovery: { enabled: true, asLocalhost: true} in apiserver.js file.

where am i doing wrong?.

Thank You in Advance!

UPDATE: Answer given by @Jerome O'Mahony worked for me!.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

栖竹 2025-01-25 08:54:14

如果我可以使用本地主机,则无需更改连接配置文件吗?

请记住,每次您构建网络时,都会创建一个新的客户端连接配置文件(CCP)文件。因此,您必须将最新版本复制到API的连接代码所在的位置。另外,您还需要执行注册管理员并为您的钱包注册用户(删除旧的)。您可以复制CCP文件,也可以在API代码中创建一个符号链接,该链接指向组织下的Peer目录中的最新版本。

您的REST API实际上是在端口8080上运行的。创建一个在JSON中返回“ Hello World”的测试页面,以便您至少可以验证API的机制在担心是否可以连接到HyperLeDger之前是否有效。

另外,最好使用小命令行测试程序来查看是否可以连接到HyperLeDger网络并在添加之间添加API的复杂性之前。

if i can use local host there is no need to change connection profile right?

Just remember that everytime that you build your network, a new client connection profile (CCP) file will be created. Therefore, you will have to copy the most recent version to where your connection code for the API is. Also you will need to perform the register Admin and Register User for your wallet (delete the old ones). You can either copy the CCP file or else create a symbolic link in your API code that points to the latest version in the peer directory under organizations.

Is your REST API actually running on port 8080. Create a test page that returns "Hello World" in JSON so that you can at least verify that the mechanics of the API work before worrying about whether it can connect to Hyperledger.

Also, it is best to use a small command line test program to see if you can connect to, and query, the Hyperledger network before adding the complication of adding an API in between.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文