Introducing DotNetFunda.com on mobile http://m.dotnetfunda.com ! Be with DotNetFunda.com on the go !
Go to DotNetFunda.com
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 3492 |  Welcome, Guest!   Register  Login
Home > Articles > WCF > WCF Hosting in Windows Services

WCF Hosting in Windows Services

Article posted by Anup1252000 on 1/28/2010 | Views: 10982 | Category: WCF | Level: Beginner red flag


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.

Page copy protected against web site content infringement by Copyscape
Found interesting? Add this to:



Please Sign In to vote for this post.

About anup hosur

Experience:2 year(s)
Home page:
Member since:Saturday, August 01, 2009
Level:Starter
Status: [Member]
Biography:
>> Write Response - Respond to this post and get points
Related Posts

WCF has introduced lot of bindings and protocols. This article will concentrate on two important protocols BasicHttpBinding and WsHttpBinding which look similar but have some huge fundamental differences. So we will first start with the difference and then we will make a small project and see how the differences look practically.

This post teaches you how can you unleash the power of WCF and JSON. Complete walkthrough with sample code as download

In this article we will concentrate on WCF concurrency and throttling. We will first try to understand what are WCF concurrency and the 3 important types of WCF concurrency. We will then see a small sample of WCF concurrency with single and multiple. We will then go through 9 combinations of WCF concurrency and instancing. Finally we will try to understand how to configure throttling using WCF ‘web.config’ file.

There are three different ways through one can Debug WCF service. In the article all 3-ways are described.

WCF is distributed programming platform . Using WCF, you can create applications that function as both services and service clients.Security in WCF provides Authentication,Authorization,Integrity,Confidentiality. Here in this article I have discussed security in WCF.

More ...
About Us | Contact Us | The Team | Advertise | Software Development | Write for 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. | 5/21/2012 7:41:04 AM