Dışarıya aktar (0) Yazdır
Tümünü Genişlet
EN
Bu içerik dilinizde bulunmamaktadır ancak İngilizce sürümüne buradan bakabilirsiniz.

Creating a Service Bus URI

Updated: January 7, 2015

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 SAS tokens for authentication and credential verification. While you can manually create the URI, or store it in the App.config file, it’s recommended that you use the Microsoft.ServiceBus.ServiceBusEnvironment.CreateServiceUri(System.String,System.String,System.String) or Microsoft.ServiceBus.ServiceBusEnvironment.CreateAccessControlUri(System.String) methods to create your URIs, as those members contain all the relevant default settings.

noteNote
Service Bus performs case-insensitive comparisons of service namespaces to align with the behavior of IIS. 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.

  1. Create the URI with a call to CreateServiceUri or CreateAccessControlUri, respectively.

    Uri address = ServiceBusEnvironment.CreateServiceUri("sb", solutionName, "EchoService");
    

Example

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");

Show:
© 2015 Microsoft