Readme_HelloWorld_CLR Sample
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
This sample shows a simple, stateless application that uses the ServiceBrokerInterface sample.
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
In Visual Studio 2005, open
HelloWorldCS.sln
orHelloWorldVB.sln
.Build the solution by pressing F6, or by selecting Build Solution from the Build menu.
Run
Install.cmd
, located in theScripts
folder of theHelloWorld_CLR
directory. This file sets up the environment, and then runs theInstall.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 theInstall.sql
script.
Running the sample
- 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.