Mobile Service Configuration: MS_NotificationHubConnectionString Contains Invalid Setting Key “entitypath”

北城余情 提交于 2019-12-10 19:35:21

问题


I'm trying to create a new Azure Mobile Service, however when trying to call a Custom API it generates the following error in the logs of the service.

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".

The error only seems to generate when making an API call, not when making a call on a table.

The MS_NotificationHubConnectionString is where this connection string is stored, however it was auto generated along with the service hub and isn't editable in the service configuration.

The EntityPath key doesn't appear in the MS_NotificationHubConnectionString of any of my older services. The Mobile Service has a JavaScript back end.

How do I prevent this error or remove the EntityPath key from the connection string?


回答1:


Currently, here is a workaround: we login Kudu console site of the Mobile Service backend, modify MS_NotificationHubConnectionString in the script which will create notification hub service directly in source code.

  1. login in Kudu console site, whose url should be https://<your_mobile_service_name>.scm.azure-mobile.net/DebugConsole
  2. In the file system list in the page, enter to the path D:\home\site\wwwroot\node_modules\azure-mobile-services\runtime\push, edit the file pushadapter.js
  3. Add following code to the start of the function PushAdapter in this script around line 22:

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

Any further concern, please feel free to let me know.



来源:https://stackoverflow.com/questions/36277946/mobile-service-configuration-ms-notificationhubconnectionstring-contains-invali

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!