Creating a Service Bus URI
Updated: June 18, 2014
A Service Bus URI is a universal resource identifier (URI) that describes the location at which an endpoint is exposed on Service Bus. You use a Service Bus URI when you connect with both a service and client application. You also use a Service Bus URI when you connect to retrieve tokens for authentication and credential verification with the Access Control service. While you can manually create the URI, or store it in the App.config file, it’s recommended that you use the CreateServiceUri or CreateAccessControlUri methods to create your URIs, as those members contain all the relevant default settings.
|Service Bus performs case-insensitive comparisons of service namespaces to align with the behavior of IIS. Because Access Control is designed as a general purpose access control service, it performs case-sensitive comparisons of service namespaces and scopes. Thus, applications that rely on Access Control can decide to be case sensitive or case insensitive, depending on the needs of that application. When designing applications that support multitenancy, you should realize that Access Control performs case-sensitive comparisons and Service Bus performs case-insensitive comparisons, if this difference in behavior produces unexpected results in your application. Because Access Control prevents creating scopes that differ only by case, this difference in behavior should not present a security issue.|
The following example shows how to programmatically create a Service Bus URI.
Console.Write("Your Service Namespace (ex. sb://<ServiceNamespace>.servicebus.windows.net/): "); string serviceNamespace = Console.ReadLine(); Console.Write("Your Issuer Name: "); string issuerName = Console.ReadLine(); Console.Write("Your Issuer Secret: "); string issuerSecret = Console.ReadLine(); // create the service URI based on the solution name Uri address = ServiceBusEnvironment.CreateServiceUri("sb", serviceNamespace, "EchoService");