'How to make C# Azure Function work with Static Web App?
I created a Static Web App per the instructions on this page. The Javsscript Azure Function worked.
Then I replaced the API with a C# version. Now when I publish the Function to Azure, I get the following error.
The function language 'dotnet' is unsupported or invalid. The following languages are valid: node.
Is this due to Azure Static WebApp wont support dotnet/C#? How can I use C# inside a Static Web App if it can support?
Solution 1:[1]
c# functions are supported for azure static-web-apps. The Visual-Studio-Code Azure Static Web Apps extension can create all the necessary files for you automatically, according to the build-workflow file.
On this website you can find a detailed description about how to do it: https://www.whitesourcesoftware.com/free-developer-tools/blog/azure-functions-static-web-apps/
Solution 2:[2]
The API Functions app in C# does not be supported.
Azure Static Web Apps provides an API through Azure Functions. The capabilities of Azure Functions are focused to a specific set of features that enable you to create an API for a web app and allow the web app to connect to API securely. And the API Functions app must be in JavaScript.
Have a look of this:
https://docs.microsoft.com/en-us/azure/static-web-apps/apis#constraints
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Peter Widmer |
Solution 2 | Cindy Pau |