4

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?

2

2 Answers 2

2

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/

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

Comments

0

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://learn.microsoft.com/en-us/azure/static-web-apps/apis#constraints

3 Comments

At time of writing, learn.microsoft.com/en-us/azure/static-web-apps/… states "The API must either be a JavaScript, C#, or Python Azure Functions app." I can't get it to work tho.
I have a static web app with c# Azure function as api. I might be able to help you if you can share your code on GitHub.
I don't know what the link in the answer said when the answer was posted (always be sure to quote relevant material!!), but it now says "The Azure Functions app must either be in Node.js 12, Node.js 14, Node.js 16, Node.js 18 (public preview), .NET Core 3.1, .NET 6.0, Python 3.8, Python 3.9 or Python 3.10 (public preview)." (my emphasis), so the answer is (now) incorrect.

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.