My First WCF Program.
I am starting with very dumb way to start a WCF program, just follow the steps below.(Click the image to enlarge)
I am starting with very dumb way to start a WCF program, just follow the steps below.(Click the image to enlarge)
Step 1: Open Visual Studio and click on File -->New-->Project
Step 2 : Click on Visual C# then WCF Service Application, Use the same file name as shown MyFirstWCF.
Step 3: You will get an inbuilt template as shown in below picture, with some pre-written method.
Step 4: Add a new Operation Contract in Interface Iservice1.CS as shown
Step 5: Now you have to implement this method in the Service1.svc.cs as it is inheriting the above Interface.
Step 6: Right click on service1.svc and make it as Set as Start page and then press F5.
Step 7: Your basic Services are made, run it and get the result.
Step 8: Now add one more Project, Class Library named as UsingMyFirstWCF (a step further to understand it more)'
Step 9: Add a reference in your MyFirstWCF Project of the above project.
Step 10: Make a method in Class1.cs of UsingMYFirstWCF project, as shown below.
Step 11: In service1.svc.cs make an object of above mentioned class library, and use it to call the public method Display Name
Step 12: RUN it and VOILA!!! Keep WCFing :) :) keep debugging.
Comments
Post a Comment
Important - Make sure to click the Notify Me check-box below the comment to be notified of follow up comments and replies.