我不明白爲什麼不......
首先,你要記住,觸發該通知的代碼是實際使用的通知中心的名稱和通知集線器連接字符串中的一個。
讓我們來看看爲Notification Hub Tutorial on App Services提出的代碼。這是從應用服務的插件發送通知的代碼:
// Get the Notification Hubs credentials for the Mobile App.
string notificationHubName = settings.NotificationHubName;
string notificationHubConnection = settings.Connections[MobileAppSettingsKeys.NotificationHubConnectionString].ConnectionString;
// Create a new Notification Hub client.
NotificationHubClient hub = NotificationHubClient
.CreateClientFromConnectionString(notificationHubConnection, notificationHubName);
現在,請讓我們來看看這個段從這個post如何使用環境變量從部署插槽採取:
<td>ConnectionString: </td>
<td><%= Environment.GetEnvironmentVariable("SQLAZURECONNSTR_ConnectionString") %></td>
最後的建議here,那麼你可以使用任何CUSTOMCONNSTR_或APPSETTING_以獲得通知中心名稱和通知集線器連接的是DEP結束於您的部署插槽。