1

I have created an httpTrigger azure function and trying to access it from my azure web app. Both the web app and azure function belongs to the same resource group.

While calling the published azure function from post man and localhost it is working perfectly without any issues. After publishing the web app to azure, I am getting an error

'No such host is known'

. The function trigger is not at all visible in Monitor tab

Web app call

        HttpClient client = new HttpClient();
        var content = new StringContent(JsonConvert.SerializeObject(functionRequest), Encoding.UTF8, "application/json");
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken);
        var status = client.PostAsync(url, content).Result;

Azure function app

        public async Task<HttpResponseMessage> HttpStart(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequestMessage req,
             [DurableClient] IDurableClient starter,
            ILogger log, ClaimsPrincipal principal)
        {
        }

Any help will be highly appreciated.

10
  • are you connecting to a database? Commented Aug 17, 2020 at 17:54
  • 'No such host is known' usually means that your deployment had issues. You can troubleshoot this through the portal to get to the root of the error. If you post more relevant code I can spot check it. Commented Aug 17, 2020 at 17:54
  • @lopezbertoni- I have already posted the client call and function signature, What kind of deployment error you suspect? Commented Aug 17, 2020 at 18:00
  • 1
    how you are invoking the function? what is the url? Commented Aug 17, 2020 at 18:03
  • 1
    i think the URL is not correct. Also, can you confirm the function is displayed in functions blade at Azure portal. Commented Aug 17, 2020 at 18:17

2 Answers 2

1

I try to create DurableClient Trigger, and test it in portal but not in web app, and it works for me.

So I think you should change your url in var status = client.PostAsync(url, content).Result;. And you will solve the issue.

After request the url which from Get function URL. You will get id,statusQueryGetUri,sendEventPostUri,terminatePostUri,purgeHistoryDeleteUri. For more details, you can refer to the offical document.

enter image description here

You can get something you want from statusQueryGetUri.

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

0

Thank you everyone for your help. I found the issue. The url I got from the azure function blade was private url, which works from localhost even postman. But I had to get public url using gateway, That works for azure too

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.