pmhsfelix / WebApi.Explorations.ServiceBusRelayHost

Web API Host using Azure Service Bus Relaying

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ASP.NET Web API Host using Azure Service Bus Relaying

Introduction

This project aims to provide a HttpServiceBusHost class for hosting ASP.NET Web API using the Azure Service Bus relaying functionality.

Usage example:

var config = new HttpServiceBusConfiguration(ServiceBusCredentials.ServiceBusAddress)
    {
        IssuerName = "owner",
        IssuerSecret = ServiceBusCredentials.Secret
    };
config.Routes.MapHttpRoute("default", "{controller}/{id}", new { id = RouteParameter.Optional });
var server = new HttpServiceBusServer(config);
server.OpenAsync().Wait();
Console.WriteLine("Server is opened at {0}", config.Address);
Console.ReadKey();
server.CloseAsync().Wait();

Build

  1. The ServiceBusRelayHost.Tests and ServiceBusRelayHost.Demo.Screen projects are both missing a SecretCredentials.cs file. These file contain the Service Bus credentials, with the following structure, and are never committed into the repository.
namespace WebApi.Explorations.ServiceBusRelayHost.Tests
{
    public class ServiceBusCredentials
    {
        public static readonly string ServiceBusAddress = "https://???????.servicebus.windows.net/webapi/";
        public static readonly string Secret = "????";
    }
}

Please create these files locally, using an adequate service bus address and secret.

About

Web API Host using Azure Service Bus Relaying

License:Other


Languages

Language:C# 100.0%