Search code examples
c#azure-functionsazure-function-async

Azure Function V1 with WPF Controls


I tried to use Azure function v1 that contains some WPF controls. while Azure funtion v1 supports .Net framework, and it is supposed to work with windows environment. whenever the debugger reaches the WPF control, exception is being thrown shows that

"InvalidOperationException: The calling thread must be STA, because many UI components require this. "

This is how my code looks like, I tested the function within browser.

 [FunctionName("Report1")]
 public static async Task<HttpResponseMessage> RunReport([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "hash/{hash1}")]HttpRequestMessage req, string hash1, TraceWriter log, Microsoft.Azure.WebJobs.ExecutionContext context){}

Solution

  • Dont have this usage method, Azure Function does not support UI. WPF controls should not be handled in Azure Functions.