How to link SignalR service with Azure Serveless Functions - Deploy from Visual Studio for Mac?

_mrli 1 Reputation point
2020-07-28T15:26:34.86+00:00

While I am replicating the sample app described in this link , to make use of SignalR service with Azure functions since I am new to both. The steps given in the doc/link seems to be outdated.

I have followed step by step but stuck at one point where the Azure Functions need to be published from Visual Studio by linking the SignalR service. The doc says to choose Edit Azure App Service Settings to link the SignalR service Connection string. I don't see any such option. Also I use Visual Studio for Mac for dev & publishing the Azure Functions.

Can you please help me in linking the Azure Functions with SignalR service?

PS: Azure functions are deployed successfully with out SignalR link, when I try to access any of the functions I get 500: Internal Server Exception

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,212 questions
Azure SignalR Service
Azure SignalR Service
An Azure service that is used for adding real-time communications to web applications.
120 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 15,606 Reputation points
    2020-07-30T18:28:09.89+00:00

    Hi @mrli-7807 ,

    Thanks for your patience. I looked at the documentation you were following and it looks like some of the screen shots in the tutorial are outdated. Please see this documentation " Quickstart: Create a chat room with Azure Functions and SignalR Service using C#" to see how to link the Azure Functions with SignalR service.

    Here are the steps the doc provides to configure and run the Azure Function app with SignalR service:

    1.Start Visual Studio (or another code editor) and open the solution in the src/chat/csharp folder of the cloned repository.
    2. In the browser where the Azure portal is opened, confirm the SignalR Service instance you deployed earlier was successfully created by searching for its name in the search box at the top of the portal. Select the instance to open it.
    3. Select Keys to view the connection strings for the SignalR Service instance.
    4. Select and copy the primary connection string.
    5. Back in Visual Studio, in Solution Explorer, rename local.settings.sample.json to local.settings.json.
    6. In local.settings.json, paste the connection string into the value of the AzureSignalRConnectionString setting. Save the file.
    7. Open Functions.cs. There are two HTTP triggered functions in this function app:

    • GetSignalRInfo - Uses the SignalRConnectionInfo input binding to generate and return valid connection information.
    • SendMessage - Receives a chat message in the request body and uses the SignalR output binding to broadcast the message to all connected client applications.
    1. Use one of the following options to start the Azure Function app locally.
    2. Visual Studio: In the Debug menu, select Start debugging to run the application.

    You can also view this doc for additional information on SignalR Service bindings for Azure Functions

    Hope that helps. Please let us know if you have further questions.

    Thanks,

    Grace

    0 comments No comments