WCF Tutorial, Part 5: WCF Service Host and WCF Test Client

01. December 2013 WCF 0

The WCF Service Library project template creates an application configuration file named App.config which needed to be modified to reflect the Service class and interface names. Class names should include the namespace as well.

The typical WCF configuration file has the following schema:

Configuration

  • system.serviceModel
    • services
      • service ( name = "RoomReservationService.RoomReservationService" )
        • endpoint ( address = "" binding = "basicHttpBinding" contract = "RoomReservationContracts.IRoomService" )
        • endpoint ( address = "mex" binding = "mexHttpBinding" contract = "IMetadataExchange" )
        • host
          • baseAddresses
            • add (baseAddress="http://localhost:8733/RoomReservation/" )

App.config

Test the WCF Service

By running the project Visual Studio will be automatically runs the service and opens the WCF Test Client application. These default behaviors can be changed via WCF Service Project Properties. In Debug tab
/client:”WcfTestClient.exe” command argument has added to Start Options which will run the WCF Test Client application. In the WCF Options tab you can remove the checkbox where starts the WCF Host when a project starts.

The WCF Test client can be used to test the service.

Take note that the RoomReservation database is created in the SQL Server.


Leave a Reply

Your email address will not be published. Required fields are marked *