Click here to Skip to main content
12,945,927 members (37,280 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Web service name is UF17DataDownloader, am start starting this by creating object
DataDownload = new UF17DataDownloader();

can any one tell me how to stop this service
Posted 28-Dec-12 22:26pm
Updated 28-Dec-12 22:37pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Well, on top of which framework does your srevice was built???
Please, clarify as much as possible in your question!
Thanks for your reply.
am using Framework 3.5

protected void btnStartService_Click(object sender, EventArgs e)
if (btnStartService.Text == "Start Service")
DataDownload = new UF17DataDownloader();
btnStartService.Text = "Stop Service";
if (DataDownload != null)
btnStartService.Text = "Start Service";

i want to start and stop service by clicking on button
Oleksandr Kulchytskyi 29-Dec-12 4:50am
Ok, where did you get this UF17DataDownloader?
This module was written by U?
one website i created, in that only that UF17DataDownloader Webservice also there,
that Web Service will act as TCPIP server to Download data from clients.
Webpage contains one Button to start and Stop Service.On button click i need stop this Service.
Oleksandr Kulchytskyi 29-Dec-12 5:06am
Whithout any internals of UF17DataDownloader i can't advise you smth.
In UF17DataDownloader am using TCPListener to act as server,
whenever data received from client i will store in Text file.Am this and all in that Web services
Oleksandr Kulchytskyi 29-Dec-12 5:26am
Ok, wait few minutes... and i will provide you with basic idea.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

class Server
    private volatile bool _isStopRequested=false;
    private TcpListener tcpListener;
    private Thread listenThread;
    public Server()
      this.tcpListener = new TcpListener(IPAddress.Any, 3000);
      this.listenThread = new Thread(new ThreadStart(ListenForClients));
    public void Start()
public void Stop(){ 

  private void ListenForClients()
    while (!_isStopRequested)
      //blocks until a client has connected to the server
      TcpClient client = this.tcpListener.AcceptTcpClient();
      //do some stuff with your workflow....

i think you will catch the basic idea of starting and stopping service.
From this i got that i can start and stop the TCPIP server,
is it possible to stop Web service itself
Oleksandr Kulchytskyi 29-Dec-12 5:57am
Well i completelly confused. as far as i understood UF17DataDownloader itself is your web service ?
As concerns real web-services in dot Net, where does you host it ? And which type of service WCF ?
If yes and it host in windows enviromnemnt , though:

host = new ServiceHost(serviceType);
host.Open(); //-- start WCF service;


host.Close(); // -operation that stops WCF service.

In case os IIS hosting of web-service ... this won't work.,..
yes UF17DataDownloader is the Web service, now am just running it in visual studio 2008, it is not WCF Service and also not completely web sevice,
i created one web site in that i added Web service.In that website itself i want to start and stop web service,is it possible to do.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 4,899
CHill60 3,180
Maciej Los 2,453
Jochen Arndt 1,910
ppolymorphe 1,785

Advertise | Privacy | Mobile
Web02 | 2.8.170518.1 | Last Updated 29 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100