我正在尝试创建新的Azure移动服务,但是在尝试调用自定义API时,它会在服务日志中生成以下错误。
为用户脚本创建推送时出错: 无法创建azure.notificationHubService。 HubName: “servicenamehub”ConnectionString “端点= SB://servicenamehub-ns.servicebus.windows.net/; SharedAccessKeyName = DefaultFullSharedAccessSignature; SharedAccessKey = {accesskey}; EntityPath = servicenamehub“:来自的错误 create-Error:无效的连接字符串设置键“entitypath”。
在进行API调用时,似乎只会生成错误,而不是在对表进行调用时生成错误。
MS_NotificationHubConnectionString
是存储此连接字符串的位置,但它是与服务中心一起自动生成的,并且在服务配置中不可编辑。
EntityPath密钥未出现在我的任何旧服务的MS_NotificationHubConnectionString
中。移动服务有一个JavaScript后端。
如何防止此错误或从连接字符串中删除EntityPath密钥?
答案 0 :(得分:1)
目前,这是一个解决方法:我们登录移动服务后端的Kudu控制台站点,在脚本中修改MS_NotificationHubConnectionString
,这将直接在源代码中创建通知中心服务。
https://<your_mobile_service_name>.scm.azure-mobile.net/DebugConsole
D:\home\site\wwwroot\node_modules\azure-mobile-services\runtime\push
,编辑文件pushadapter.js
在第22行的脚本中将以下代码添加到函数PushAdapter
的开头:
var string = options.MS_NotificationHubConnectionString;
var index = string.indexOf('EntityPath');
options.MS_NotificationHubConnectionString = index>0?string.slice(0,string.indexOf('EntityPath')-1):string;
如有任何疑问,请随时告诉我。