Partilhar via


Readme_HelloWorld_CLR

This sample shows a simple, stateless application that uses the ServiceBrokerInterface sample.

By default, the Hello World CLR sample application is installed at C:\Program Files\Microsoft SQL Server\100\Samples\Engine\\ServiceBroker\HelloWorld_CLR. If the sample folder is not present, see Installing Samples.

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.

Building and Installing the sample

  1. In Visual Studio 2005, open HelloWorldCS.sln or HelloWorldVB.sln.

  2. Build the solution by pressing F6, or by selecting Build Solution from the Build menu.

  3. Run Install.cmd, located in the Scripts folder of the HelloWorld_CLR directory. This file sets up the environment, and then runs the Install.sql install script. If you built the Visual Basic version of the project, you might have to change the "cs" in the path for the assembly to "vb" in the Install.sql script.

Running the sample

  1. Run the HelloWorldClient.exe console application from the sample directory. To exit the client, press Enter after the client shows the response.

Requirements

This sample requires Visual Studio 2005. Because the sample uses features of the common language runtime (CLR) that were not available in earlier versions, versions of Visual Studio earlier than 2005 cannot build the sample.

Demonstrates

This sample demonstrates use of the sample object-oriented programming interface provided in the Service Broker Interface sample. All Service Broker functionality for the sample uses the Service Broker Interface.

There are two main parts of the sample: a client program that runs outside of SQL Server, and a CLR stored procedure that implements the service.

The external program begins a conversation from the service HelloWorldClient to the service HelloWorldService, and then sends a message on that conversation. This application sends a Request message to the service HelloWorldService. The activated stored procedure receives and responds to the message. The client receives a response, shows the response on the console, and then ends the dialog.

The CLR stored procedure implements the HelloWorldService. Service Broker activates this procedure. The procedure reads a message from the queue. For a Request message, the procedure responds with a Response message. For a Service Broker end dialog message, the procedure ends the conversation.

Change History

Release History

5 December 2005

Changed content:
  • Changed instructions for generating a key file, including the name and location of the key file.