Skip to content

Instantly share code, notes, and snippets.

@HenrikFrystykNielsen
Created April 3, 2014 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HenrikFrystykNielsen/9947717 to your computer and use it in GitHub Desktop.
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.
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