Quick start from VS2k8

With VS2k8 the quickes way to add a WCF service and client is also done in an asmx-like way.

The service uses wsHttpBinding. If the service must be compatible with asmx clients then the binding must be basicHttpBinding.


  1. Generate the service:
    – From VS2k8: File – New – Website – WCF Service – “EnterANameForTheService” – OK
  2. Build the service:
    – RightClick the service project – “Build Web site
  3. Start the service:
    – RightClick the file Service.svc – “View in browser
    => A page with instructions for building a client appears.

Console client:

  1. Add a client:
    – From the same solution: RightClick the solution – Add – New Project – Console Application – “EnterANameForTheClient” – OK
  2. Add a service proxy:
    – RightClick the client project –Add Service Reference – In the address box paste the address from the running service ie http://localhost:1192/WCFService2/Service.svc – GO
    => The service is found and namespace is proposed.
    – OK
  3. Add code that uses the service to Program.cs:
            static void Main(string[] args)
                using (ServiceReference1.ServiceClient prxy = new ServiceReference1.ServiceClient())
                    string s = prxy.GetData(1);
  4. Build the client:
    – RightClick the client project – “Build
  5. Run the client:
    – RightClick the client project – Debug – “Start new instance”

Debug the solution:

  • RightClick the solution – Properties – “Startup Project”
  • Select “Multiple startup projects
  • For both projects: Set action “Start” – OK
  • Start debug by pressing F5
    => Popup says: Debugging Not Enabled.
  • Press OK for modifying web.config. This sets…
      <compilation debug="true"/>

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: