While our preference is to use configuration files as much as possible for WCF development,
we cannot count on the availability of a configuration file, nor do we want to burden the
developer user with manually adding the configuration XML in an application configuration
file to support making web service calls via WCF in the Search custom server control. Therefore,
we programmatically create the necessary binding and channel to communicate with the
Live Search service.
580 CHAPTER 12 ?– B U ILDING A COMPLEX CONTROL
Instead of using the Add Service Reference functionality in Visual Studio 2008, we take a
different route for our server control, because we want more predictability in the generated
code, and we want to make changes to it without worrying about the changes being overridden
by an automated process. For WCF, we use the command-line utility named svcutil.exe from
a Visual Studio 2008 command prompt to generate a proxy class for the Live Search web service
that is similar in its code-generation capabilities to the Add Web Reference tool in Visual Studio.
Make sure you use the command prompt that comes with Visual Studio or make sure the
binary wsdl.exe file is in your path before you try the following command on the Live Search
SearchSearch.
Pages:
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759