I have an Azure Function in Net 4.8 (stuck to framework due to WCF)
The Function is trying to receive messages from Azure Servicebus using ServiceBusTrigger.
I get en exception stating:
<code>Cannot convert input parameter 'message' to type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage' from type 'System.String'
<code>Cannot convert input parameter 'message' to type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage' from type 'System.String'
</code>
Cannot convert input parameter 'message' to type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage' from type 'System.String'
My assumption is that my function is running “in-process” instead of “isolated” since it tries to map the first argument as a string instead of ServiceBusReceivedMessage, is this correct?
But I can’t understand why it is running in-process then.
In my .csproj I have “Exe”
<code><TargetFramework>net48</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
<code><TargetFramework>net48</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
</code>
<TargetFramework>net48</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
I’m referencing the following packages:
<code> <PackageReference Include="Azure.Messaging.ServiceBus" Version="7.17.5" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="5.18.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.0.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.10.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.7.0" />
<code> <PackageReference Include="Azure.Messaging.ServiceBus" Version="7.17.5" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="5.18.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.0.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.10.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.7.0" />
</code>
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.17.5" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="5.18.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.0.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.10.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.7.0" />
My host.json has:
<code>{
"version": "2.0"
}
</code>
{
"version": "2.0"
}
My deployed function has the following app settings:
"name": "FUNCTIONS_EXTENSION_VERSION",
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet-isolated",
<code>{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~4",
"slotSetting": false
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet-isolated",
"slotSetting": false
}
</code>
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~4",
"slotSetting": false
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet-isolated",
"slotSetting": false
}
My implementation is decorated with:
<code>[Function("myspecialfunction")]
public async Task Run([ServiceBusTrigger("myspecialqueue", Connection = "<secret>")] ServiceBusReceivedMessage message, ServiceBusMessageActions messageActions)
<code>[Function("myspecialfunction")]
public async Task Run([ServiceBusTrigger("myspecialqueue", Connection = "<secret>")] ServiceBusReceivedMessage message, ServiceBusMessageActions messageActions)
</code>
[Function("myspecialfunction")]
public async Task Run([ServiceBusTrigger("myspecialqueue", Connection = "<secret>")] ServiceBusReceivedMessage message, ServiceBusMessageActions messageActions)
What could possibly be wrong?