.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> WCF >> Post New Resource Bookmark and Share   

 Subscribe to Articles

WCF Application Communicate with Console Application

Posted By:Dinkar       Posted Date: April 19, 2011    Points: 200    Category: WCF    URL: http://www.dotnetspark.com  

All of know WCF (windows Communication Foundation).wcf service can communicate with any Application like Silverlight, webforms in Asp.Net,Console Application.so this Article contain those who are beginner in WCF for that this simple Application communicate with Console Application step by step.
 

All of know WCF (windows Communication Foundation).wcf service can communicate with any Application like Silverlight,webforms in Asp.Net,Console Application.so this Article  contain those who are beginner in WCF for that this simple Application communicate with Console Application.

So ,lets see step by step how to do.

Step 1) Go to VS studio 2010 -new website-select WCF service-Give some name like service.

Step 2) Go to Iservice.cs and write this code:

{
  [OperationContract]
  int Add(int a, int b);
 
 
  [OperationContract]
  int Mul(int a, int b);
 
}

Step 3) Now go to Service .cs  and write this one:

{
  public int Add(int a, int b)
  {
  return a + b;
   throw new NotImplementedException();
  }
 
  public int Mul(int a, int b)
  {
  return a * b;
  throw new NotImplementedException();
  }
}

Step 4) Now Add Console Application Go to file on IDE-Add-New project-Console Application

Step 5) Go to Console Application right click-Add service reference there Discover option click on Discover Gove some namespace like SR

Step 6) Now write this code inprogram.cs
{
  public int Add(int a, int b)
  {
  return a + b;
  throw new NotImplementedException();
  }
 
  public int Mul(int a, int b)
  {
  return a * b;
  throw new NotImplementedException();
  }
}

Step 7) Run the Application
 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend