Development How To

 

Applies To: Service Bus for Windows Server 1.1

This section contains a set of common how-to tasks related to development using Service Bus for Windows Server.

Service Bus Development How-to

  • How to use REST with Service Bus

  • How to use Service Bus while offline (for example, from your laptop), but installed locally

How to use REST with Service Bus

Service Bus for Windows Server offers REST API for runtime and management operations similar to the API offered by Microsoft Azure Service Bus. For a detailed description of Service Bus REST support, see the Service Bus REST API Reference [SB]. There are some differences in using REST with Service Bus for Windows Server.

How to use Service Bus while offline (for example, from your laptop), but installed locally

Service Bus for Windows Server enables you to develop and test applications while being offline or without access to the domain. Note that this scenario implies that Service Bus for Windows Server is installed locally on the same computer on which you are developing and testing, and is therefore available even when the machine is not connected to a network. With Service Bus for Windows Server, you can use the credentials of a local user, similar to domain users.

To use a local user with your application, do the following:

  1. Modify your service namespace (or create a new one) and add the local user as one of the manageUsers by calling the Set-SBNamespace cmdlet. Note that this call overrides the existing manageUsers list.

  2. Modify your code to create a TokenProvider object with credentials for the local user. For example:

    TokenProvider localUserTokenProvider = WindowsTokenProvider.CreateWindowsTokenProvider(
                    connBuilder.StsEndpoints,
                    new System.Net.NetworkCredential (userName, password));
    
    MessagingFactory factory = MessagingFactory.Create(
                connBuilder.GetAbsoluteRuntimeEndpoints(), localUserTokenProvider);
    NamespaceManager namespaceManager = new NamespaceManager(
                connBuilder.GetAbsoluteManagementEndpoints(), localUserTokenProvider);