Home > OS >  Azure Functions in Isolated Mode - How to create a HTTP Trigger
Azure Functions in Isolated Mode - How to create a HTTP Trigger

Time:02-06

I'm trying to set-up an Azure Isolated Function as a HTTP trigger:

[Function("Function1")]
public static async Task<IActionResult> Run(
    [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] 
    HttpRequest req,
    ILogger log)

However: HttpTrigger is in this namespace:

using Microsoft.Azure.WebJobs;

But when I add it, it tells me that I can't / shouldn't use that with an isolated function:

The attribute 'HttpTriggerAttribute' is a WebJobs attribute and not supported in the .NET Worker (Isolated Process).

Is there an alternate process for .Net Isolated?

Following comments and answers, I've tried changing this, and have worked out that HttpTrigger is the real culprit. My dependencies are as follows:

  <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Abstractions" Version="1.1.0" />    
  <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.3.0" />
  <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.6.0" />
  <PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.31" />
  <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.0.12" />

Using statements:

using System.Threading.Tasks;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.WebJobs;

I still get the same error.

CodePudding user response:

Microsoft.Azure.WebJobs is supported in Azure Functions Isolated Process also.

First, You need to install the above package from the NuGet Package Manager in the Visual Studio Project. enter image description here

Secondly, we need to write the namespace header like using Microsoft.Azure.WebJobs; in the Http Trigger Function Class and it is greyed at starting. It is enabled until you write the code related to that namespace as you can see below:

enter image description here

Updated Answer:

Please check your function declaration in the function class as it should be HttpRequestData but you have HttpRequest.

enter image description here

  •  Tags:  
  • Related