Skip to content

pmhsfelix/WebApi.Explorations.ServiceBusRelayHost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages