Azure function works with blazor and localhost but nothing appears to happen when I deploy it to Azure

Daniel noyn 1 Reputation point
2021-04-01T00:40:52.907+00:00

I am new to azure web functions.
I created a web function and got it working on localhost and was able to step through it, calling it from my Blazor webapp.

I changed the url to the one listed in my launch code when I published as the base address. (No longer listing a port number) and published both the Blazor app and the Azure Function to Azure. It appears the function is not being called at all.

I have searched for clues and one was to set it to anonymous which I did from the default value.

as far as I can tell the function is not being called at all on azure, but I am not sure. I see mention of a password and such, but since I have anonymous enabled, I have not looked further at this.

Any suggestions? Is there a magic setting I didn't know to do?

Thanks
`
[FunctionName("intent")]
public static async Task<string> RunIntentToPurchase(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,124 questions
Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,595 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,536 Reputation points
    2021-04-01T06:35:41.45+00:00

    Hi @Daniel noyn

    Welcome to Microsoft Q&A! Thanks for posting the question.

    I will first suggest you to verify whether you are able to run your function app (HTTP trigger) from any of the tools such as postman/fiddler to verify whether you are able to execute your function or not. If you are not able to run the function app HTTP trigger then the troubleshooting needs to start from the function app end.

    If the function was executed successfully then I will suggest you to review the blazor code how you are calling the function. If you have deployed the blazor code in azure storage then the suggestion will be to verify whether your storage in a virtual network or any NSG blocking the call to the azure function.

    The above will help you with the initial troubleshooting to verify which component might be causing the issue. If you have configured the function authorization level then you can still pass the authentication keys in query parameter while calling the function endpoint.

    I am also sharing some of the reference articles/videos that can help you start with Blazor, Azure Functions, and Azure Storage.
    https://www.youtube.com/watch?v=QeSNtE4HnZY
    https://azure.microsoft.com/en-in/resources/videos/build-2019-serverless-web-apps-with-blazor-azure-functions-and-azure-storage/
    https://microsoft.github.io/AzureTipsAndTricks/blog/tip286.html
    https://channel9.msdn.com/Shows/On-NET/Blazor-and-Azure-Functions

    Once you have tested the above please share your result/observation if you need any assistance in troubleshooting it further.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.