Hi!

Im new on this forum.. so Hello to all :)

Im a beginner in programming WCF.Im a student, on our faculty, we get a new task to make a project in WCF.I hope that you guys could help me a little bit..I dont know how to start.I watched some toturials on youtube and so on..

So here is my task:


Create Web services using Windows Communication Foundation framework - WCF.

In Visual Studio select the WCF Service Application project and add a new service, provided with a service, operations and data contract. The service must have parameters and return values ​​in the form of objects.

Create a synchronous and asynchronous client to initiate service. Place a full solution that covers both service and client.

Edited 5 Years Ago by diGGity: n/a

Well, if this is to be a permanent WCF application, you will need to determine how you're hosting it. Is it to be self-hosted or attached to IIS?

No its not gonna be permanent.. its must be self hosted i think.Beacuse our profesor just check if program working properly.

So, I guess we don't need to worry too much about elegance.

After you've created your base project (and compiled it), you will need to create a class and store some data in objects of that class for the service to return.

You can use a class like this inside your "Service1.svc.cs" file right after the declaration of the namespace

public class CPerson
   {
      public string strFirstName { get; set; }
      public string strLastName { get; set; }

      public CPerson()
      {
         strFirstName = "";
         strLastName = "";
      }

      public CPerson(string strFirstName, string strLastName)
      {
         this.strFirstName = strFirstName;
         this.strLastName = strLastName;
      }
   }

2) Populate a static dictionary, array, or list of those objects right inside your Service1 class.

3) create a public method IN your service 1 class that returns 1 of those based on either position or value

4) Modify your IService1.cs to contain an OperationContract that uses the same method signature as the method (without the public).

Let me know when you've done that.

Ive made the project, some toturials helped me, i hope that i did the right thing :) thx for help anyway.

This article has been dead for over six months. Start a new discussion instead.