Chapter 11: Deploying Web Services with WCF | 337 |
Regardless of the name, each configuration file will have a system.serviceModel element with configuration settings for the Web service. Listing
Listing 11-8 Web service client configuration
<?xml version="1.0"
<system.serviceModel>
...
<client>
<endpoint address="http://localhost:8732 /Design_Time_Addresses/WcfDemoCS/CustomerService /"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICustomerService"
contract="CustomerService.ICustomerService" name="WSHttpBinding_ICustomerService">
...
</system.serviceModel>
</configuration>
Following the path system.serviceModel, client, endpoint, you’ll find an address attribute. In the preceding example, the address is set to the address of the WcfDemo project inside the same solution. When you deploy your client, you’ll want it to communicate with the deployed Web service. The following modification allows this client to communicate with the Web service deployed to IIS as discussed previously in this chapter:
<endpoint
address="http://localhost:8080/WcfDemoCS.CustomerService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICustomerService" contract="CustomerService.ICustomerService" name="WSHttpBinding_ICustomerService">
The address includes a filename, WcfDemoCS.CustomerService.svc, which was automatically generated when deploying the WcfDemo service. You can see the name of this file by looking at the physical folder where the Web service is deployed.
Creating a Web Service in a Web Site
The previous discussion of creating a Web service created a separate project for the Web service. This approach assumes that you have the ability to configure an IIS Web site for the Web service and can have another IIS Web site for your application if you have