Example 1:
WCF SERVICE WITH CONSOLE (Run visual studio as Admin)
File->New-> Project (select console application) using http binding
And add new item
Right click on the project Name and select Add Reference
Add the Reference àSystem.ServiceModel.dll
WCF always recommends interface pattern for defining contract for user
So Add New Item ->Create Interface with required methods and then Add WCF Attributes to it
.
and write the following code.
And again add new item and give the name as Demo.cs and inherit the Job.cs file.
And write the following code.
And go to program.cs and write the following code.
Now service is ready. And select start debugging & see the output
Note: when running client application service should be running.
Client Application.
And write the following code in Program.cs as below
And run the program and see the output. First run Service and make sure that service is running and then run the client application.
No comments:
Post a Comment
Thank you for visiting my blog