Go to DotNetFunda.com
 Online : 746 |  Welcome, Guest!   Login
 
Home > Articles > WCF > WCF Hosting in Windows Services

Submit Article | Articles Home | Search Articles |

WCF Hosting in Windows Services

red flag  Posted on: 1/28/2010 7:53:50 AM by Anup1252000 | Views: 1832 | Category: WCF | Level: Beginner


In this article, we are going to see how to host Windows service in WCF and automatically start and stop the Service by using Button click events.



Introduction
            In this article, we are going to see how to host Windows service in WCF and automatically start and stop the Service by using Button click events.

Let us go through this application step by step



Step1:
  I suggest you to go through this article
 http://msdn.microsoft.com/en-us/library/ms733069.aspx
Implement the same. Actually i need to explain a lot of thing here,so i suggested you to go through this article.


Step2:
  Create a new Web For application->name it->Add the service reference to it.

  In the Form design, add 2 button's one as start,another as stop and put a label to it.


Step3:
   Now give a reference to System.ServiceProcess.
 
   Now add your service reference to generate the proxy and we are going to use ServiceController method to automatically start and stop the service.





Step4:

   Now ,in the Form load event write these lines

  


Scratched content contains computer name.Because its confidential i can't disclose infront of you people. Service name is the same whatever i suggested you people to read. We are checking the status, if it suggests that service is running then there is no point in stopping the service.


Step5:
   Now let see what we are going to do in start and stop functionality.




I implemented the same functionality whatever i did in form load event.


I hope you people like this article.

Reference:
http://msdn.microsoft.com/en-us/library/ms733069.aspx


If you like this article, subscribe to our RSS Feed. You can also subscribe via email to our Interview Questions, Codes and Forums section.

Found interesting? Add this to:

| More



Please Sign In to vote for this post.

 
Latest post(s) from Anup1252000

Latest Articles

About anup hosur

Experience:2 year(s)
Home page:
Member since:Saturday, August 01, 2009
Level:Starter
Status: [Member]
Biography:

Submit Article

About Us | The Team | Advertise | Contact Us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you found plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 9/3/2010 4:14:16 AM