Chapter 11: Deploying Web Services with WCF

323

When you create a new WCF Service project, VS adds a file named app.config to the project, which is a file that belongs only to VS. The app.config file is never deployed with your Web service, but it generates a file named web.config, which is deployed with the project. In WPF projects, VS uses the app.config file to generate a file named projectname.exe.config in the same folder as the projectname.exe file. WCF Service projects don’t generate a config file in the output folder, but they do generate a web.config file when you deploy. You’ll see web.config soon, after deployment.

During development, you work with the app.config file, which is easy to find and open in your project. The app.config file has a lot of information in it, so Listing 11-6 is a small excerpt that shows you the salient elements of the WCF configuration.

Listing 11-6 The WCF service address in app.config

<?xml version="1.0" encoding="utf-8" ?> <configuration>

...

<system.serviceModel>

<bindings>

...

</bindings> <client /> <services>

<service name="WcfDemoCS.CustomerService">

...

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

<host>

<baseAddresses>

<add baseAddress= "http://localhost:8732/Design_Time_Addresses /WcfDemoCS/CustomerService/" />

</baseAddresses>

</host>

</service>

</services>

...

</system.serviceModel>

...

</configuration>

Page 346
Image 346
Microsoft 9GD00001 manual 323, Listing 11-6 The WCF service address in app.config