<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Janne Mattila's blog : WCF</title><link>http://blogs.msdn.com/jannemattila/archive/tags/WCF/default.aspx</link><description>Tags: WCF</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Web Services and namespaces (or WCF?)</title><link>http://blogs.msdn.com/jannemattila/archive/2008/10/15/web-services-and-namespaces-or-wcf.aspx</link><pubDate>Wed, 15 Oct 2008 10:27:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9000423</guid><dc:creator>jannemattila</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/jannemattila/comments/9000423.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jannemattila/commentrss.aspx?PostID=9000423</wfw:commentRss><description>&lt;p&gt;You might have encountered following situation:    &lt;br /&gt;1. You have created class library “MyLibrary” and it contains following class:     &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;   &lt;table cellspacing="10"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td valign="top" align="right"&gt;           &lt;pre&gt;&lt;font color="gray"&gt;1
2
3
4
5
6
7
8&lt;/font&gt;&lt;/pre&gt;
        &lt;/td&gt;

        &lt;td valign="top"&gt;
          &lt;pre&gt;&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; MyLibrary
{
  &lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;class&lt;/font&gt; &lt;font color="#2b91af"&gt;Employee
&lt;/font&gt;  {
    &lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;string&lt;/font&gt; FirstName;
    &lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;string&lt;/font&gt; LastName;
  }
}&lt;/pre&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;

&lt;p&gt;2. You have created Web Service “MyWeb” using following VS template: 
  &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jannemattila/WindowsLiveWriter/WhyWCFsinceIlikeWebServices_78D2/Web%20Service%20project_2.png"&gt;&lt;img title="Web Service project" border="0" alt="Web Service project" src="http://blogs.msdn.com/blogfiles/jannemattila/WindowsLiveWriter/WhyWCFsinceIlikeWebServices_78D2/Web%20Service%20project_thumb.png" width="128" height="20" /&gt;&lt;/a&gt; 

  &lt;br /&gt;&amp;#160; - It references “MyLibrary” 

  &lt;br /&gt;&amp;#160; - It contains following method: &lt;/p&gt;

&lt;p&gt;
  &lt;table cellspacing="10"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign="top" align="right"&gt;
          &lt;pre&gt;&lt;font color="gray"&gt;1
2
3
4
5
6
7
8&lt;/font&gt;&lt;/pre&gt;
        &lt;/td&gt;

        &lt;td valign="top"&gt;
          &lt;pre&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;class&lt;/font&gt; &lt;font color="#2b91af"&gt;MyWeb&lt;/font&gt; : System.Web.Services.&lt;font color="#2b91af"&gt;WebService
&lt;/font&gt;{
  [&lt;font color="#2b91af"&gt;WebMethod&lt;/font&gt;]
  &lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;void&lt;/font&gt; AddNewEmployee(MyLibrary.&lt;font color="#2b91af"&gt;Employee&lt;/font&gt; employee)
  {
    &lt;font color="#008000"&gt;// TODO: implement
&lt;/font&gt;  }
}&lt;/pre&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;

&lt;p&gt;3. Finally you create Windows Forms application “My Win App”: 
  &lt;br /&gt;&amp;#160; - You “Add Web Reference” to “MyWeb” and you name it “WebServices” 

  &lt;br /&gt;&amp;#160; - You write following code to use that web service: &lt;/p&gt;

&lt;p&gt;
  &lt;table cellspacing="10"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign="top" align="right"&gt;
          &lt;pre&gt;&lt;font color="gray"&gt;1
2
3
4
5&lt;/font&gt;&lt;/pre&gt;
        &lt;/td&gt;

        &lt;td valign="top"&gt;
          &lt;pre&gt;WebServices.&lt;font color="#2b91af"&gt;Employee&lt;/font&gt; employee = &lt;font color="#0000ff"&gt;new&lt;/font&gt; WebServices.&lt;font color="#2b91af"&gt;Employee&lt;/font&gt;();
employee.FirstName = &lt;font color="#a31515"&gt;&amp;quot;John&amp;quot;&lt;/font&gt;;
employee.LastName = &lt;font color="#a31515"&gt;&amp;quot;Doe&amp;quot;&lt;/font&gt;;
WebServices.&lt;font color="#2b91af"&gt;MyWeb&lt;/font&gt; myWeb = &lt;font color="#0000ff"&gt;new&lt;/font&gt; WebServices.&lt;font color="#2b91af"&gt;MyWeb&lt;/font&gt;();
myWeb.AddNewEmployee(employee);&lt;/pre&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;

&lt;p&gt;4. You run your application and all is fine. 
  &lt;br /&gt;5. Later you notice that you need to add reference to your “MyLibrary” into your “My Win App” 

  &lt;br /&gt;(There could be many reasons for this. For example you want to use same business logic that web service uses etc.) 

  &lt;br /&gt;6. You add following code to you “My Win App”: &lt;/p&gt;

&lt;p&gt;
  &lt;table cellspacing="10"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign="top" align="right"&gt;
          &lt;pre&gt;&lt;font color="gray"&gt;1
2
3&lt;/font&gt;&lt;/pre&gt;
        &lt;/td&gt;

        &lt;td valign="top"&gt;
          &lt;pre&gt;MyLibrary.&lt;font color="#2b91af"&gt;Employee&lt;/font&gt; employee2 = &lt;font color="#0000ff"&gt;new&lt;/font&gt; MyLibrary.&lt;font color="#2b91af"&gt;Employee&lt;/font&gt;();
MyLibrary.&lt;font color="#2b91af"&gt;EmployeeManager&lt;/font&gt; employeeManager = &lt;font color="#0000ff"&gt;new&lt;/font&gt; MyLibrary.&lt;font color="#2b91af"&gt;EmployeeManager&lt;/font&gt;();
employeeManager.AddNewEmployee(employee2);&lt;/pre&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;

&lt;p&gt;7. Code works fine but then you notice that you actually have the same class from two different namespaces. What if you try to mix and match them (and sometimes you just have to do that)? Let’s see what happens:&lt;/p&gt;

&lt;p&gt;
  &lt;table cellspacing="10"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign="top" align="right"&gt;
          &lt;pre&gt;&lt;font color="gray"&gt;1
2
3&lt;/font&gt;&lt;/pre&gt;
        &lt;/td&gt;

        &lt;td valign="top"&gt;
          &lt;pre&gt;WebServices.&lt;font color="#2b91af"&gt;Employee&lt;/font&gt; employee = &lt;font color="#0000ff"&gt;new&lt;/font&gt; WebServices.&lt;font color="#2b91af"&gt;Employee&lt;/font&gt;();
MyLibrary.&lt;font color="#2b91af"&gt;EmployeeManager&lt;/font&gt; employeeManager = &lt;font color="#0000ff"&gt;new&lt;/font&gt; MyLibrary.&lt;font color="#2b91af"&gt;EmployeeManager&lt;/font&gt;();
employeeManager.AddNewEmployee(employee);&lt;/pre&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;

&lt;p&gt;8. When you try to compile your application and you’ll receive following error: 
  &lt;br /&gt;&lt;em&gt;&lt;img title="VS compile error" border="0" alt="VS compile error" src="http://blogs.msdn.com/blogfiles/jannemattila/WindowsLiveWriter/WhyWCFsinceIlikeWebServices_78D2/VS%20compile%20error_3.png" width="703" height="62" /&gt;&amp;#160; Error&amp;#160;&amp;#160;&amp;#160; 11&amp;#160;&amp;#160;&amp;#160; The best overloaded method match for 'MyLibrary.EmployeeManager.AddNewEmployee(MyLibrary.Employee)' has some invalid arguments&amp;#160;&amp;#160;&amp;#160; C:\&amp;lt;path&amp;gt;\MyWinApp\MainForm.cs&amp;#160;&amp;#160;&amp;#160; 41&amp;#160;&amp;#160;&amp;#160; 1&amp;#160;&amp;#160;&amp;#160; MyWinApp 

    &lt;br /&gt;Error&amp;#160;&amp;#160;&amp;#160; 12&amp;#160;&amp;#160;&amp;#160; Argument '1': cannot convert from 'MyWinApp.WebServices.Employee' to 'MyLibrary.Employee'&amp;#160;&amp;#160;&amp;#160; C:\&amp;lt;path&amp;gt;\MyWinApp\MainForm.cs&amp;#160;&amp;#160;&amp;#160; 41&amp;#160;&amp;#160;&amp;#160; 32&amp;#160;&amp;#160;&amp;#160; MyWinApp 

    &lt;br /&gt;&lt;/em&gt;

  &lt;br /&gt;9. You open up the generated proxy code: 

  &lt;br /&gt;&lt;img title="Reference" border="0" alt="Reference" src="http://blogs.msdn.com/blogfiles/jannemattila/WindowsLiveWriter/WhyWCFsinceIlikeWebServices_78D2/Reference_3.png" width="172" height="97" /&gt; 

  &lt;br /&gt;

  &lt;br /&gt;10. You locate the code where &lt;em&gt;Employee&lt;/em&gt; is defined and comment that part. And then you compile again with following results: 

  &lt;br /&gt;&lt;em&gt;Error&amp;#160;&amp;#160;&amp;#160; 11&amp;#160;&amp;#160;&amp;#160; The type or namespace name 'Employee' could not be found (are you missing a using directive or an assembly reference?)&amp;#160;&amp;#160;&amp;#160; C:\&amp;lt;path&amp;gt;\MyWinApp\Web References\WebServices\Reference.cs&amp;#160;&amp;#160;&amp;#160; 82&amp;#160;&amp;#160;&amp;#160; 36&amp;#160;&amp;#160;&amp;#160; MyWinApp 
    &lt;br /&gt;&lt;/em&gt;

  &lt;br /&gt;11. You fix that by resolving the missing type: 

  &lt;br /&gt;&lt;img title="VS Resolve" border="0" alt="VS Resolve" src="http://blogs.msdn.com/blogfiles/jannemattila/WindowsLiveWriter/WhyWCFsinceIlikeWebServices_78D2/VS%20Resolve_3.png" width="518" height="66" /&gt; &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;12. You compile and you’re happy right (obviously you need to modify also all &lt;em&gt;WebServices.Employee&lt;/em&gt; types to &lt;em&gt;MyLibrary.Employee&lt;/em&gt; types)?&lt;/p&gt;

&lt;p&gt;Well you might be happy since now your code works... &lt;strong&gt;BUT&lt;/strong&gt; you have manually edited generated file which will be re-generated every time you do “Update Web Reference” from Visual Studio and you’ll lose you modifications. And that’s not nice.&lt;/p&gt;

&lt;p&gt;If this would be question for me I would give you following answer (you might find different opinions on this one): Go to the WCF route instead &lt;strong&gt;:-) &lt;/strong&gt;If Windows Communication Foundation (WCF) is something new to you I think you should check these out and find more information on the web: &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Windows_Communication_Foundation"&gt;Overview of WCF from Wikipedia&lt;/a&gt; and &lt;a target="_blank" href="http://msdn.microsoft.com/en-us/netframework/aa663324.aspx"&gt;Windows Communication Foundation home on MSDN&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;I’m going to run through this same example with WCF way and then we can (hopefully) see why it fits like good glove.&lt;/p&gt;

&lt;p&gt;1. Create new WCF project called “MyWcf” using following VS template: 
  &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/jannemattila/WindowsLiveWriter/WhyWCFsinceIlikeWebServices_78D2/WCF%201_2.png"&gt;&lt;img title="WCF 1" border="0" alt="WCF 1" src="http://blogs.msdn.com/blogfiles/jannemattila/WindowsLiveWriter/WhyWCFsinceIlikeWebServices_78D2/WCF%201_thumb.png" width="138" height="18" /&gt;&lt;/a&gt; 

  &lt;br /&gt;2. Add reference to “MyLibrary” 

  &lt;br /&gt;3. Delete &lt;em&gt;IService1.cs&lt;/em&gt; and &lt;em&gt;Service1.svc &lt;/em&gt;from your newly created project. 

  &lt;br /&gt;4. Add new item “MyWcfService.svc” (using &lt;em&gt;WCF Service &lt;/em&gt;template) 

  &lt;br /&gt;5. Modify “IMyWcfService.cs” file: 

  &lt;table cellspacing="10"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign="top" align="right"&gt;
          &lt;pre&gt;&lt;font color="gray"&gt;1
2
3
4
5
6
7
8
9
10
11
12&lt;/font&gt;&lt;/pre&gt;
        &lt;/td&gt;

        &lt;td valign="top"&gt;
          &lt;pre&gt;&lt;font color="#0000ff"&gt;using&lt;/font&gt; System.ServiceModel;
&lt;font color="#0000ff"&gt;using&lt;/font&gt; MyLibrary;

&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; MyWcf
{
  [&lt;font color="#2b91af"&gt;ServiceContract&lt;/font&gt;]
  &lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;interface&lt;/font&gt; &lt;font color="#2b91af"&gt;IMyWcfService
&lt;/font&gt;  {
    [&lt;font color="#2b91af"&gt;OperationContract&lt;/font&gt;]
    &lt;font color="#0000ff"&gt;void&lt;/font&gt; AddNewEmployee(&lt;font color="#2b91af"&gt;Employee&lt;/font&gt; employee);
  }
}&lt;/pre&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
6. Modify “MyWcfService.cs” file: 

  &lt;table cellspacing="10"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign="top" align="right"&gt;
          &lt;pre&gt;&lt;font color="gray"&gt;1
2
3
4
5
6
7
8
9
10
11
12
13&lt;/font&gt;&lt;/pre&gt;
        &lt;/td&gt;

        &lt;td valign="top"&gt;
          &lt;pre&gt;&lt;font color="#0000ff"&gt;using&lt;/font&gt; System;
&lt;font color="#0000ff"&gt;using&lt;/font&gt; MyLibrary;

&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; MyWcf
{
  &lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;class&lt;/font&gt; &lt;font color="#2b91af"&gt;MyWcfService&lt;/font&gt; : &lt;font color="#2b91af"&gt;IMyWcfService
&lt;/font&gt;  {
    &lt;font color="#0000ff"&gt;public&lt;/font&gt; &lt;font color="#0000ff"&gt;void&lt;/font&gt; AddNewEmployee(&lt;font color="#2b91af"&gt;Employee&lt;/font&gt; employee)
    {
      &lt;font color="#008000"&gt;// TODO: implement
&lt;/font&gt;    }
  }
}&lt;/pre&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
7. Open up “web.config” and modify the &lt;em&gt;system.serviceModel&lt;/em&gt; section as follows: 

  &lt;table cellspacing="10"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign="top" align="right"&gt;
          &lt;pre&gt;&lt;font color="gray"&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20&lt;/font&gt;&lt;/pre&gt;
        &lt;/td&gt;

        &lt;td valign="top"&gt;
          &lt;pre&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#a31515"&gt;system.serviceModel&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;
 &amp;lt;&lt;/font&gt;&lt;font color="#a31515"&gt;services&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;
  &amp;lt;&lt;/font&gt;&lt;font color="#a31515"&gt;service&lt;/font&gt;&lt;font color="#0000ff"&gt; &lt;/font&gt;&lt;font color="#ff0000"&gt;behaviorConfiguration&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt;MyWcf.MyWcfServiceBehavior&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt; &lt;/font&gt;&lt;font color="#ff0000"&gt;name&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt;MyWcf.MyWcfService&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt;&amp;gt;
   &amp;lt;&lt;/font&gt;&lt;font color="#a31515"&gt;endpoint&lt;/font&gt;&lt;font color="#0000ff"&gt; &lt;/font&gt;&lt;font color="#ff0000"&gt;address&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&amp;quot;&amp;quot;&lt;font color="#0000ff"&gt; &lt;/font&gt;&lt;font color="#ff0000"&gt;binding&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt;basicHttpBinding&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt; &lt;/font&gt;&lt;font color="#ff0000"&gt;contract&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt;MyWcf.IMyWcfService&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt;&amp;gt;
    &amp;lt;&lt;/font&gt;&lt;font color="#a31515"&gt;identity&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;
     &amp;lt;&lt;/font&gt;&lt;font color="#a31515"&gt;dns&lt;/font&gt;&lt;font color="#0000ff"&gt; &lt;/font&gt;&lt;font color="#ff0000"&gt;value&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt;localhost&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt; /&amp;gt;
    &amp;lt;/&lt;/font&gt;&lt;font color="#a31515"&gt;identity&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;
   &amp;lt;/&lt;/font&gt;&lt;font color="#a31515"&gt;endpoint&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;
   &amp;lt;&lt;/font&gt;&lt;font color="#a31515"&gt;endpoint&lt;/font&gt;&lt;font color="#0000ff"&gt; &lt;/font&gt;&lt;font color="#ff0000"&gt;address&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt;mex&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt; &lt;/font&gt;&lt;font color="#ff0000"&gt;binding&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt;mexHttpBinding&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt; &lt;/font&gt;&lt;font color="#ff0000"&gt;contract&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt;IMetadataExchange&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt; /&amp;gt;
  &amp;lt;/&lt;/font&gt;&lt;font color="#a31515"&gt;service&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;
 &amp;lt;/&lt;/font&gt;&lt;font color="#a31515"&gt;services&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;
 &amp;lt;&lt;/font&gt;&lt;font color="#a31515"&gt;behaviors&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;
  &amp;lt;&lt;/font&gt;&lt;font color="#a31515"&gt;serviceBehaviors&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;
   &amp;lt;&lt;/font&gt;&lt;font color="#a31515"&gt;behavior&lt;/font&gt;&lt;font color="#0000ff"&gt; &lt;/font&gt;&lt;font color="#ff0000"&gt;name&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt;MyWcf.MyWcfServiceBehavior&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt;&amp;gt;
    &amp;lt;&lt;/font&gt;&lt;font color="#a31515"&gt;serviceMetadata&lt;/font&gt;&lt;font color="#0000ff"&gt; &lt;/font&gt;&lt;font color="#ff0000"&gt;httpGetEnabled&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt;true&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt; /&amp;gt;
    &amp;lt;&lt;/font&gt;&lt;font color="#a31515"&gt;serviceDebug&lt;/font&gt;&lt;font color="#0000ff"&gt; &lt;/font&gt;&lt;font color="#ff0000"&gt;includeExceptionDetailInFaults&lt;/font&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt;false&lt;/font&gt;&amp;quot;&lt;font color="#0000ff"&gt; /&amp;gt;
   &amp;lt;/&lt;/font&gt;&lt;font color="#a31515"&gt;behavior&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;
  &amp;lt;/&lt;/font&gt;&lt;font color="#a31515"&gt;serviceBehaviors&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;
 &amp;lt;/&lt;/font&gt;&lt;font color="#a31515"&gt;behaviors&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;
&amp;lt;/&lt;/font&gt;&lt;font color="#a31515"&gt;system.serviceModel&lt;/font&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/pre&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
(you might notice that most important part is the &lt;strong&gt;binding&lt;em&gt; &lt;/em&gt;&lt;/strong&gt;what I have changed to be &lt;strong&gt;basicHttpBinding&lt;/strong&gt;) 

  &lt;br /&gt;

  &lt;br /&gt;8. Go back to your “My Win App” project. 

  &lt;br /&gt;&amp;#160; - Remove “WebServices” web references 

  &lt;br /&gt;&amp;#160; - Add new “Service Reference” to your newly created WCF Service and name it “WcfServices” 

  &lt;br /&gt;&amp;#160; - Verify that you have “Reuse types in referenced assemblies” checked in settings (you can see them if you click &lt;em&gt;Advanced...&lt;/em&gt; button from the “&lt;em&gt;Add Service Reference”&lt;/em&gt; dialog): 

  &lt;br /&gt;&lt;img title="WCF 2" border="0" alt="WCF 2" src="http://blogs.msdn.com/blogfiles/jannemattila/WindowsLiveWriter/WhyWCFsinceIlikeWebServices_78D2/WCF%202_3.png" width="287" height="256" /&gt;&amp;#160; &lt;br /&gt;

  &lt;br /&gt;9. Modify your code to use this new service: 

  &lt;table cellspacing="10"&gt;&lt;tbody&gt;
      &lt;tr&gt;
        &lt;td valign="top" align="right"&gt;
          &lt;pre&gt;&lt;font color="gray"&gt;1
2
3
4
5&lt;/font&gt;&lt;/pre&gt;
        &lt;/td&gt;

        &lt;td valign="top"&gt;
          &lt;pre&gt;MyLibrary.&lt;font color="#2b91af"&gt;Employee&lt;/font&gt; employee = &lt;font color="#0000ff"&gt;new&lt;/font&gt; &lt;font color="#2b91af"&gt;Employee&lt;/font&gt;();
employee.FirstName = &lt;font color="#a31515"&gt;&amp;quot;John&amp;quot;&lt;/font&gt;;
employee.LastName = &lt;font color="#a31515"&gt;&amp;quot;Doe&amp;quot;&lt;/font&gt;;
WcfServices.&lt;font color="#2b91af"&gt;MyWcfServiceClient&lt;/font&gt; myWcf = &lt;font color="#0000ff"&gt;new&lt;/font&gt; MyWinApp.WcfServices.&lt;font color="#2b91af"&gt;MyWcfServiceClient&lt;/font&gt;();
myWcf.AddNewEmployee(employee);&lt;/pre&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
10. Enjoy one of the benefits of WCF &lt;strong&gt;:-)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is just one of the many benefits that WCF over the “good old ASP.NET Web Services”. So if you’re interested then you should start looking more information on the web. 
  &lt;br /&gt;

  &lt;br /&gt;Anyways... Happy hacking! 

  &lt;br /&gt;

  &lt;br /&gt;J&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9000423" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jannemattila/archive/tags/.NET+General/default.aspx">.NET General</category><category domain="http://blogs.msdn.com/jannemattila/archive/tags/tips+and+tricks/default.aspx">tips and tricks</category><category domain="http://blogs.msdn.com/jannemattila/archive/tags/Programming/default.aspx">Programming</category><category domain="http://blogs.msdn.com/jannemattila/archive/tags/WCF/default.aspx">WCF</category></item></channel></rss>