CallingBotServiceSettings.cs
2 using System;
3 using System.Configuration;
4 
5 namespace Microsoft.Bot.Builder.Calling
6 {
8  {
13  public string CallbackUrl { get; set; }
14 
20  {
22 
23  try
24  {
25  settings = new CallingBotServiceSettings
26  {
27  CallbackUrl = ConfigurationManager.AppSettings.Get("Microsoft.Bot.Builder.Calling.CallbackUrl")
28  };
29  }
30  catch (Exception e)
31  {
32  throw new BotConfigurationException(
33  "A mandatory configuration item is missing or invalid", e);
34  }
35 
36  settings.Validate();
37  return settings;
38  }
39 
43  public void Validate()
44  {
45  Uri callBackUri;
46  if (!Uri.TryCreate(this.CallbackUrl, UriKind.Absolute, out callBackUri))
47  {
48  throw new BotConfigurationException($"Bot calling configuration is invalid, callback url: {CallbackUrl} is not a valid url!");
49  }
50  }
51  }
52 }
Exception type thrown when the bot configuration is invalid
void Validate()
Validates current bot configuration and throws BotConfigurationException if the configuration is inva...
Root namespace for the Microsoft Bot Builder Calling SDK.
Namespace for exceptions raised by the Microsoft Bot Builder Calling SDK.
static CallingBotServiceSettings LoadFromCloudConfiguration()
Loads core bot library configuration from the cloud service configuration
Root namespace for the Microsoft Bot Builder SDK.