Export (0) Print
Expand All

Readme_ServiceBrokerConfiguration Sample

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

This sample works only with SQL Server 2005 and SQL Server 2008. It will not work with any version of SQL Server earlier than SQL Server 2005.

This sample shows how to create Service Broker objects by using SQL Server Management Objects (SMO). The sample is implemented because several Windows User Controls and classes necessary to create Service Broker objects.

The sample is targeted at a Microsoft .NET Framework developer who wants to learn how to use Service Broker SMO and learn how to create Windows User Controls to manage SQL Server objects. The core scenario is a Microsoft .NET Framework developer who is creating a custom Service Broker management application.

Samples are provided for educational purposes only. They are not intended to be used in a production environment and have not been tested in a production environment. Microsoft does not provide technical support for these samples. Sample applications and assemblies should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator.

This sample requires that the following components are installed.

If the code sample was installed to the default location, the sample is located in the following directory:

C:\Program Files\Microsoft SQL Server\100\Samples\Engine\Programmability\SMO\ServiceBrokerConfiguration

The C# solution for the code sample is located in the CS directory.

If you have not already created a strong name key file, generate the key file using the following instructions.

  1. Open a Microsoft Visual Studio 2005 command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.

    -- or --

    Open a Microsoft .NET Framework command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.

  2. Use the change directory command (CD) to change the current directory of the command prompt window to the folder where the samples are installed.
    ms345273.note(en-us,SQL.105).gifNote:
    To determine the folder where samples are located, click the Start button, point to All Programs, point to Microsoft SQL Server, point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <system_drive>:\Program Files\Microsoft SQL Server\100\Samples.
  3. At the command prompt, run the following command to generate the key file:

    sn -k SampleKey.snk

    ms345273.note(en-us,SQL.105).gifImportant:
    For more information about the strong-name key pair, see "Security Briefs: Strong Names and Security in the .NET Framework" in the .NET Development Center on MSDN.

If you are using the Microsoft .NET Framework SDK, do the following:

  1. Click Start, point to All Programs, point to Microsoft .NET Framework SDK v2.0, and then click SDK Command Prompt.

  2. Locate the root folder of the sample. Type the following command for the default location:

  3. [C#]

cd \Program Files\Microsoft SQL Server\100\Samples\Engine\Programmability\SMO\ServiceBrokerConfiguration\CS\

  1. Type the following to build the Visual Studio solution:
    • msbuild

Or, if you are using Visual Studio 2005, do the following:

  1. Open the \CS\ConfigurationComponent.sln solution file.
  2. Press F6 to build the solution.

  1. Locate the \CS\Script folder.

  2. Open and run setup.sql from within SQL Server Management Studio.

If you are setting up Remote Service Binding:

  1. Locate the \CS\Script folder.

  2. Open masterkey.sql from within SQL Server Management Studio.

  3. Enter a password for the master database key in the CREATE MASTER KEY ENCRYPTION BY PASSWORD = statement.

  4. Enter a password for the ssb_ConfigurationSample database key in the CREATE MASTER KEY ENCRYPTION BY PASSWORD = statement.

  5. Run masterkey.sql.

  1. The default location for the C# version is C:\Program Files\Microsoft SQL Server\100\Samples\SMO\ServiceBrokerConfiguration\CS\SampleApplication\bin\Debug\SampleApplication.exe.

  1. Enter a server name in the Server Name field, or accept the default (local) server name.

  2. Click Connect.

  1. Click Options on the Objects tab.

  2. Enter a ScriptPath, or accept the default path. The ScriptPath is used to export a script to a file.

  3. Click Create. The Create button configures the sample, including setting the BaseUrn.

  1. Click New, and then click MessageType.

  2. Enter ShippingRequest for the MessageType name.

  3. Click Create to create the new MessageType, click New, and then click Message Type.

  4. Enter ShippingAccept for the MessageType name.

  5. Click Create to create the new MessageType, click New, and then click Message Type.

  6. Enter ShippingComplete for MessageType name.

  7. Click Create to create the new MessageType.

  1. Click New, and then click Contract.

  2. Select the MessageTypeMappings drop-down menu.

  3. Select all MessageTypes created above.

  4. Select Target for ShippingAccept and ShippingComplete MessageSource.

  5. Close the MessageTypeMappings drop-down menu.

  6. Enter Shipping for the contract name.

  7. Click Create to create a new contact.

  1. Click New, and then click Queue.

  2. Enter ClientQueue for the queue name.

  3. Click Create to create the new queue, click New, and then click Queue.

  4. Enter ServerQueue for queue name.

  5. Click Create to create the new queue.

  1. Click New, and then click Service.

  2. Enter ClientService for the service name.

  3. Select the ContractNames drop-down menu and select the Shipping contract.

  4. Select the QueueName drop-down menu and select the ClientQueue queue.

  5. Enter or select a ServiceOwnerName.

  6. Click Create to create the new service, and then click New.

  7. Enter ServerService for the service name.

  8. Select the ContractNames drop-down and select the Shipping contract.

  9. Select the QueueName drop-down menu and select the ServerQueue queue.

  10. Enter or select a ServiceOwnerName.

  11. Click Create to create the new service.

  1. Click New, and then click Service.

  2. Enter RemoteService for the service name.

  3. Select the ContractNames drop-down menu and select the Shipping contract.

  4. Set EnableRemoteService to true.

  5. Select the QueueName drop-down menu and select the ClientQueue queue.

  6. Enter or select a ServiceOwnerName.

  7. Click Create to create the new service, and then click New.

  1. Select RemoteService within the object tree.

  2. Set AllowAnonymous to True.

  3. Click Alter to alter the service.

  1. Click New, and then click Target Instance Endpoint.

  2. Enter a name, or accept the default name.

  3. Click Create.

  1. Click the Object tab if this tab is not already active.

  2. Click Options.

  3. Enter a valid ScriptPath.

  4. Click Create.

  1. Select an object within the objects tree.

  2. Click Script then Export.

  3. The object is exported to the ScriptPath set in Application Configuration.

  1. Select a service from within the Objects tree.

  2. Click Script, and then click Export.

  3. The service script is exported to the ScriptPath set in Application Configuration.

  1. Select the object in the TreeView.

  2. Click either Drop or Edit, Drop {ObjectName}.

  1. Click the object in the Objects tree that you want to modify.

  2. Modify the properties of that object.

  3. Click Alter to alter the object.

  1. Each object can output data describing the object to a Textbox and/or DataGrid.

  2. Select an object in the TreeView.

  3. Click Query.

  1. Click the ClientService node.

  2. Drop the object.

  3. Click the ServerService node.

  4. Drop the object.

  1. Click the ClientQueue node.

  2. Drop the object.

  3. Click the ServerQueue node.

  4. Drop the object.

  1. Click the Shipping contract node.

  2. Drop the object.

  1. Click the ShippingRequest MessageType node.

  2. Drop the object.

  3. Click the ShippingAccept MessageType node.

  4. Drop the object.

  5. Click the ShippingComplete MessageType node.

  6. Drop the object.

  1. Click a Target Instance Endpoint node.

  2. Drop the object.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft