VSO
VSO

Reputation: 12646

Testing Azure Function With Local Url Error

I am building an Azure function and just updated to latest everything, this is my code:

  log.Info($"C# Timer trigger function executed at: {DateTime.Now}");

  var localCall = httpClient.GetAsync(urls[EnvironmentNames.LOCAL]);
  var localCallResult = await localCall;

  log.Info($"{EnvironmentNames.LOCAL} call status code {localCallResult.StatusCode}");

The url is:

{EnvironmentNames.LOCAL, $"local.mysite.net:5050/doThings"},

I am getting the following error when testing locally in Visual Studio:

System.ArgumentException: Only 'http' and 'https' schemes are allowed.

Parameter name: requestUri

Can I not test Azure calls locally?

Upvotes: 0

Views: 340

Answers (1)

Jerry Liu
Jerry Liu

Reputation: 17790

Make sure urls[EnvironmentNames.LOCAL] has a complete url value like http://local.mysite.net:5050/doThings. The protocol http:// or https:// can't be omitted as httpClient won't add it for us.

Upvotes: 2

Related Questions