Created
April 3, 2014 03:18
-
-
Save HenrikFrystykNielsen/9947717 to your computer and use it in GitHub Desktop.
Workaround for lost NotificationHub ConnectionString. The NotificationHub ConnectionString can get lost after the app has been running for a while. We will be updating the service shortly but in the mean time here is a workaround that fixes the issue.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class WebApiConfig | |
{ | |
public static void Register() | |
{ | |
ConfigOptions options = new ConfigOptions(); | |
HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options)); | |
// Workaround for notification hub connection string going missing. | |
IServiceSettingsProvider settingsProvider = config.DependencyResolver.GetServiceSettingsProvider(); | |
ServiceSettingsDictionary settings = settingsProvider.GetServiceSettings(); | |
string notificationHubConnectionString; | |
if (settings.TryGetValue("MS_NotificationHubConnectionString", out notificationHubConnectionString)) | |
{ | |
ConnectionSettings notificationHubSettings = | |
new ConnectionSettings(ServiceSettingsKeys.NotificationHubConnectionString, notificationHubConnectionString); | |
settings.Connections.Add(ServiceSettingsKeys.NotificationHubConnectionString, notificationHubSettings); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment