Walks you through the process of configuring a service endpoint, and testing the service via the WCF Test Client application.
Configure the service endpoint
This is the default endpoint that exposes metadata details about your service through the IMetaData Exchange contract.
- In the
Solution Explorer, right-click the
app.config file in the
OOSqlBookWCF project; then select
Edit WCF Configuration from the context menu.
- In the left pane of the Microsoft Service Configuration Editor, expand
OOSqlBookWCF.Service1; then click
Host.
- In the right pane under
Base Addresses, observe that the base address is local, as specified by the
http://localhost portion of the address.
- In the left pane, expand
Endpoints; then click the first
(Empty Name) instance listed below.
- In the right pane, click the
Contract field; then click its browse button.
- Browse to the
\bin\Debug project subdirectory.
- Double-click
OOSqlBookWCF.dll.
- Select the
OOSqlBookWCF.IsqlBook contract; then click
Open.
- Click
File > Save; then close the Editor.
Test the Service
Visual Studio provides a built-in WCF Service Host application and a WCF Test Client application that enable you to test your
service without having to create a client application.
- OOSqlBookWCF should already be set as your startup project as evidenced by its bold appearance in the
Solution Explorer; however, if it does not appear in bold, right-click the
OOSqlBookWCF project; then and select
Set as StartUp Project from the context menu.
- From the main menu, click
DEBUG > Start Without Debugging.
This starts the service and invokes the WCF Test Client window. The left pane shows the endpoint for your service and the
operations that are exposed.
- In the left pane, double-click the
Read() operation.
This populates the right pane with operation details, and enables you to test the operation.
- In the
Request pane, change the value for
stockNumber to
1111; then click
Invoke.
Note: If a
Security Warning appears, check
In the future, do not show this message.; then click
OK.
This populates the
Response pane with the data associated with stock number 1111.
- Test the operation again, substituting alternative stock numbers. Valid values are
1111,
2222, and
3333.
- Close the
WCF Test Client window.