问题
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.
- login in Kudu console site, whose url should be
https://<your_mobile_service_name>.scm.azure-mobile.net/DebugConsole
- 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 filepushadapter.js
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