Azure functions - SignalR output binding failure: ServiceEndpoints is empty. ConnectionString is null, empty, or consists only of white-space

Valeria Naldi 105 Reputation points
2023-07-17T14:25:46.6+00:00

I'm trying to run an Azure function using SignalR output binding in dotnet-isolated process, but I always have this error

"Executed 'Functions.SendToGroup' (Failed,..) System.Private.CoreLib: Exception while executing function: Functions.SendToGroup. Microsoft.Azure.SignalR.Management: ServiceEndpoints is empty. ConnectionString is null, empty, or consists only of white-space."

either running it locally or remotely.

The connection string is defined in the local.settings,json file using the key

"AzureSignalRConnectionString": ""

This is the code of the input and output Azure functions (taken from the example here https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-signalr-service-output?tabs=isolated-process&pivots=programming-language-csharp)

        [Function("negotiate")]
        public static string Negotiate(
            [HttpTrigger(AuthorizationLevel.Anonymous)] HttpRequestData req,
            [SignalRConnectionInfoInput(HubName = "dttelemetry")] string connectionInfo)
        {
            return connectionInfo;
        }
[Function("SendToGroup")]
[SignalROutput(HubName = "dttelemetry", ConnectionStringSetting = "SignalRConnection")]
public static SignalRMessageAction SendToGroup([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequestData req)
{
    using var bodyReader = new StreamReader(req.Body);
    SignalRMessageAction messageAction =  new SignalRMessageAction("newMessage")
    {
        Arguments = new[] { bodyReader.ReadToEnd() },
        GroupName = "groupToSend"
    };
    return messageAction;
}

local.settings.json

{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"AzureWebJobsStorage": "\<My AzureWebJobsStorage\> ",
"AzureSignalRConnectionString": "\<My SignalR Connection string\>"
}
}

Function App Configuration

enter image description here

I also checked this StackOverflow question Deployed Azure SignalR Function Failed: The SignalR Service connection string or endpoints are not set, but it didn't answer my problem

Can you please suggest how to fix the problem?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,385 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,459 questions
Azure SignalR Service
Azure SignalR Service
An Azure service that is used for adding real-time communications to web applications.
122 questions
0 comments No comments
{count} votes

Accepted answer
  1. Pramod Valavala 20,591 Reputation points Microsoft Employee
    2023-07-17T20:55:28.6133333+00:00

    @Valeria Naldi While AzureSignalRConnectionString is the default name for the app setting that contains the connection string for the SignalR binding, since you are setting the ConnectionStringSetting argument in the attribute, you need to use that value instead.

    So, the name/key of the app setting, both in when running on Azure or via local.settings.json, use SignalRConnection instead of AzureSignalRConnectionString.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful