I have written a simple Azure function that gets a name and returns a greeting message (as I am trying to get familiar with Azure functions...) I want to trigger the functions in a simple Console Application that I wrote in C# using Visual Studio. However, I can't get this to work. Everytime I run my code the console opens and immediately closes. I added Console.ReadLine() to try and avoid that but the same thing keeps on happening. Note that the function is working correctly when using the URL in the browser. The code I have written so far is:
static void Main(string[] args)
{
string nameToSend = "Testo";
string baseURL = "*URLGOESHERE";
string urlToInvoke = string.Format("{0}&name={1}", baseURL, nameToSend);
Run(urlToInvoke);
}
public static async void Run(string i_URL)
{
HttpClient client = new HttpClient();
HttpResponseMessage response = await client.GetAsync(i_URL);
string responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseString);
Console.ReadLine();
}
Help please! Thanks!