| title | Hybrid Connections - HTTP requests in .NET |
|---|---|
| description | Provides step-by-step instructions to create a C# console application for Azure Relay Hybrid Connections HTTP requests in .NET. |
| ms.topic | tutorial |
| ms.custom | devx-track-csharp, mode-ui, mode-api, devx-track-dotnet |
| ms.date | 01/24/2026 |
[!INCLUDE relay-selector-hybrid-connections]
In this quickstart, you create .NET sender and receiver applications that send and receive messages by using the HTTP protocol. The applications use Hybrid Connections feature of Azure Relay. To learn about Azure Relay in general, see Azure Relay.
In this quickstart, you take the following steps:
- Create a Relay namespace by using the Azure portal.
- Create a hybrid connection in that namespace by using the Azure portal.
- Write a server (listener) console application to receive messages.
- Write a client (sender) console application to send messages.
- Run applications.
To complete this tutorial, you need the following prerequisites:
- Visual Studio 2019 or later. The examples in this tutorial use Visual Studio 2022.
- An Azure subscription. If you don't have one, create a free account before you begin.
[!INCLUDE relay-create-namespace-portal]
[!INCLUDE relay-create-hybrid-connection-portal]
In Visual Studio, write a C# console application to listen for and receive messages from the relay.
[!INCLUDE relay-hybrid-connections-http-requests-dotnet-get-started-server]
In Visual Studio, write a C# console application to send messages to the relay.
[!INCLUDE relay-hybrid-connections-http-requests-dotnet-get-started-client]
-
Run the server application. You see the following text in the console window:
Online Server listening -
Run the client application. You see
hello!in the client window. The client sent an HTTP request to the server, and server responded with ahello!. -
Now, to close the console windows, press ENTER in both the console windows.
In this quickstart, you created .NET client and server applications that used HTTP to send and receive messages. The Hybrid Connections feature of Azure Relay also supports using WebSockets to send and receive messages. To learn how to use WebSockets with Azure Relay Hybrid Connections, see the WebSockets quickstart.
In this quickstart, you used .NET Framework to create client and server applications. To learn how to write client and server applications using Node.js, see the Node.js WebSockets quickstart or the Node.js HTTP quickstart.