// Please set the following connection strings in app.config for this WebJob to run: // AzureWebJobsDashboard and AzureWebJobsStorage public static void Main() { var config = new JobHostConfiguration(); if (config.IsDevelopment) { config.UseDevelopmentSettings(); } ServiceBusConfiguration serviceBusConfiguration = new ServiceBusConfiguration { ConnectionString = SettingsHelper.GetSetting("Microsoft.ServiceBus.ConnectionString") }; serviceBusConfiguration.MessageOptions.AutoRenewTimeout = TimeSpan.FromMinutes(5); config.UseServiceBus(serviceBusConfiguration); var host = new JobHost(config); // The following code ensures that the WebJob will be running continuously host.RunAndBlock(); }
private static Student GetStudentInformation(int studentId) { HttpClient client = new HttpClient(); client.BaseAddress = new Uri(SettingsHelper.GetSetting("ApiUri")); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = client.GetAsync($"api/student?id={studentId}").Result; if (response.IsSuccessStatusCode) { var dataObjects = response.GetBodyFromJsonAsync <Student>().Result; return(dataObjects); } else { Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase); } return(null); }