第四步:配置WCF服务
在Services项目中右击“App.Config”配置文件,在弹出的右键菜单中选择“编辑WCF配置”。
单击左侧的“服务”-“Wcf_MassData.DataTransfers”在右侧的Name,弹出“服务类型浏览器”对话框,在此类型中我们找到此WCF服务项目编译出来的Wcf_MassData.dll文件,双击它就可以出现此服务中的对外公布的服务,点击选中它单击确定。
这样我们就可以把对外公司的服务改变为我们刚编写的服务了。
然后,我们展开左侧“服务”->“Wcf_MassData.DataTransfers”->“终结点”,单击第一个“空名称”,从右边的“终结点属性”中的Contract中我们可以看到,这里的Contract仍然用的是Services.IService1。
那我们按照上面的做法,找到此WCF服务项目编译出来的Wcf_MassData.dll,双击它找到里面对应的ServiceContract点击确定就可以了。

点击菜单“文件”-“保存”就可以把我们对App.Config的修改保存回配置文件了。
OK,现在我们对WCF的配置算是完成了。
App.Config代码:
xml version ="1.0" encoding ="utf-8" ?>
< configuration >

     < system.web >
         < compilation debug ="true" />
     system.web >
    
     < system.serviceModel >
         < services >
             < service name ="Wcf_MassData.DataTransfers" >
                 < endpoint address ="" binding="wsHttpBinding" contract ="Wcf_MassData.IDataTransfers" >
                     < identity >
                         < dns value ="localhost" />
                     identity >
                 endpoint >
                 < endpoint address ="mex" binding ="mexHttpBinding" contract ="IMetadataExchange" />
                 < endpoint address ="basic" binding ="basicHttpBinding" bindingConfiguration=""
                     contract ="Wcf_MassData.IDataTransfers" />
                 < host >
                     < baseAddresses >
                         < add baseAddress ="http://localhost:8732/Design_Time_Addresses/Wcf_MassData/Service1/" />
                     baseAddresses >
                 host >
             service >
         services >
         < behaviors >
             < serviceBehaviors >
                 < behavior >
                    
                     < serviceMetadata httpGetEnabled ="True" />
                    
                     < serviceDebug includeExceptionDetailInFaults ="False" />
                 behavior >
             serviceBehaviors >
         behaviors >
     system.serviceModel >

configuration >