Readme_ServiceBrokerConfiguration Sample
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.
-
.NET Framework SDK 2.0. You can obtain .NET Framework SDK free of charge. For more information, see Installing the .NET Framework Documentation.
-
SQL Server Database Engine.
If you have not already created a strong name key file, generate the key file using the following instructions.
- 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.
- Use the change directory command (CD) to change the current directory of the command prompt window to the folder where the samples are installed.
Note:
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. - At the command prompt, run the following command to generate the key file:
sn -k SampleKey.snk
Important:
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:
-
Click Start, point to All Programs, point to Microsoft .NET Framework SDK v2.0, and then click SDK Command Prompt.
-
Locate the root folder of the sample. Type the following command for the default location:
-
[C#]
cd \Program Files\Microsoft SQL Server\100\Samples\Engine\Programmability\SMO\ServiceBrokerConfiguration\CS\
-
Type the following to build the Visual Studio solution:
-
msbuild
-
Or, if you are using Visual Studio 2005, do the following:
-
Open the \CS\ConfigurationComponent.sln solution file.
-
Press F6 to build the solution.
If you are setting up Remote Service Binding:
-
Locate the \CS\Script folder.
-
Open masterkey.sql from within SQL Server Management Studio.
-
Enter a password for the master database key in the CREATE MASTER KEY ENCRYPTION BY PASSWORD = statement.
-
Enter a password for the ssb_ConfigurationSample database key in the CREATE MASTER KEY ENCRYPTION BY PASSWORD = statement.
-
Run masterkey.sql.
-
Click New, and then click MessageType.
-
Enter ShippingRequest for the MessageType name.
-
Click Create to create the new MessageType, click New, and then click Message Type.
-
Enter ShippingAccept for the MessageType name.
-
Click Create to create the new MessageType, click New, and then click Message Type.
-
Enter ShippingComplete for MessageType name.
-
Click Create to create the new MessageType.
-
Click New, and then click Contract.
-
Select the MessageTypeMappings drop-down menu.
-
Select all MessageTypes created above.
-
Select Target for ShippingAccept and ShippingComplete MessageSource.
-
Close the MessageTypeMappings drop-down menu.
-
Enter Shipping for the contract name.
-
Click Create to create a new contact.
-
Click New, and then click Service.
-
Enter ClientService for the service name.
-
Select the ContractNames drop-down menu and select the Shipping contract.
-
Select the QueueName drop-down menu and select the ClientQueue queue.
-
Enter or select a ServiceOwnerName.
-
Click Create to create the new service, and then click New.
-
Enter ServerService for the service name.
-
Select the ContractNames drop-down and select the Shipping contract.
-
Select the QueueName drop-down menu and select the ServerQueue queue.
-
Enter or select a ServiceOwnerName.
-
Click Create to create the new service.
-
Click New, and then click Service.
-
Enter RemoteService for the service name.
-
Select the ContractNames drop-down menu and select the Shipping contract.
-
Set EnableRemoteService to true.
-
Select the QueueName drop-down menu and select the ClientQueue queue.
-
Enter or select a ServiceOwnerName.
-
Click Create to create the new service, and then click New.