Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Web service name is UF17DataDownloader, am start starting this by creating object
like
DataDownload = new UF17DataDownloader();


can any one tell me how to stop this service
Posted
Updated 28-Dec-12 22:37pm
v2

Well, on top of which framework does your srevice was built???
Please, clarify as much as possible in your question!
 
Share this answer
 
Comments
kalaivanan from Bangalore, India 29-Dec-12 4:38am    
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";
}
else
{
if (DataDownload != null)
DataDownload.Dispose();
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?
kalaivanan from Bangalore, India 29-Dec-12 4:56am    
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.
kalaivanan from Bangalore, India 29-Dec-12 5:12am    
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
C#
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()
    {
     this.listenThread.Start();
    }

public void Stop(){ 
_isStopRequested=false;
}


  private void ListenForClients()
  {
    this.tcpListener.Start();

    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.
 
Share this answer
 
Comments
kalaivanan from Bangalore, India 29-Dec-12 5:43am    
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.,..
kalaivanan from Bangalore, India 29-Dec-12 6:04am    
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900