gpt4 book ai didi

node.js - 移动服务配置: MS_NotificationHubConnectionString Contains Invalid Setting Key "entitypath"

转载 作者:搜寻专家 更新时间:2023-11-01 00:00:22 26 4
gpt4 key购买 nike

我正在尝试创建新的 Azure 移动服务,但是当尝试调用自定义 API 时,它会在服务日志中生成以下错误。

An error occurred creating push for user scripts: azure.notificationHubService could not be created. HubName: "servicenamehub" ConnectionString "Endpoint=sb://servicenamehub-ns.servicebus.windows.net/; SharedAccessKeyName=DefaultFullSharedAccessSignature; SharedAccessKey={accesskey};EntityPath=servicenamehub": Error from create-Error: Invalid connection string setting key "entitypath".

该错误似乎仅在进行 API 调用时生成,而不是在表上进行调用时生成。

MS_NotificationHubConnectionString 是存储此连接字符串的位置,但它是与服务中心一起自动生成的,并且在服务配置中不可编辑。

EntityPath 键没有出现在我的任何旧服务的 MS_NotificationHubConnectionString 中。移动服务有一个 JavaScript 后端。

如何防止此错误或从连接字符串中删除 EntityPath 键?

最佳答案

目前,有一个解决方法:我们登录Mobile Service后端的Kudu控制台站点,修改MS_NotificationHubConnectionString在脚本中,它将直接在源代码中创建通知中心服务。

  1. 登录 Kudu 控制台站点,其 URL 应为 https://<your_mobile_service_name>.scm.azure-mobile.net/DebugConsole
  2. 在页面的文件系统列表中,输入路径D:\home\site\wwwroot\node_modules\azure-mobile-services\runtime\push ,编辑文件pushadapter.js
  3. 将以下代码添加到函数的开头 PushAdapter在此脚本中第 22 行左右:

    var string = options.MS_NotificationHubConnectionString;
    var index = string.indexOf('EntityPath');
    options.MS_NotificationHubConnectionString = index>0?string.slice(0,string.indexOf('EntityPath')-1):string;

如有任何进一步的疑问,请随时告诉我。

关于node.js - 移动服务配置: MS_NotificationHubConnectionString Contains Invalid Setting Key "entitypath",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36277946/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com