how to use windows service in another project?
-
Narendra Reddy Vajrala wrote:
actually but i have to do in windows services only
why? Says who?
i cant break my PL orders :(
-
Hi Experts, i created a windows service to insert data in to a sql table. now i want to call this windows service in another project how can i call this? i tried to add service reference but it is asking for url how can i give this? like webservices, is windows services also contain URL? please help me out Thanks In Advance --Naren
You are confusing web services and Windows services. I suggest you buy a book.
Cheers, Vikram.
Recent activities: TV series: Friends, season 9 Books: Freakonomics, by Steven Levitt and Stephen J Dubner.
Carpe Diem.
-
i cant break my PL orders :(
who make him PL :confused:. Use web service..
himanshu
-
Narendra Reddy Vajrala wrote:
"The service on local machine started and stopped. some services stopped automatically if they have no work to do for example the performance logs and alerts service.
This error means there is some error in the code of your window service. You have not done any exception handling.Write Try/Catch block to catch the exception and log that error in event viewer or log file.
himanshu
same error no change :( even i used try catch block.
-
You are confusing web services and Windows services. I suggest you buy a book.
Cheers, Vikram.
Recent activities: TV series: Friends, season 9 Books: Freakonomics, by Steven Levitt and Stephen J Dubner.
Carpe Diem.
my code is like this in windows services class
protected override void OnStart(string[] args) { insertValues(3, "Naresh Kumar", "3658213641", "Begumpet, Hyderabad"); } public void insertValues(int custId, string custName, string custPhone, string custAdd) { string insertCommand = "Insert into CUSTOMER values ( " + custId + ",'" + custName + "','" + custPhone + "','" + custAdd + "')"; con.Open(); cmd = new SqlCommand(insertCommand, con); cmd.ExecuteNonQuery(); con.Close(); }
when am trying run this service from computer Mangement is it displaying below alert "The service on local machine started and stopped. some services stopped automatically if they have no work to do for example the performance logs and alerts service." please help me out -
same error no change :( even i used try catch block.
Hi Have you log your error in log file or somewhere else... Read error from there and post it. Also, Do not use window service for this task.
himanshu
-
my code is like this in windows services class
protected override void OnStart(string[] args) { insertValues(3, "Naresh Kumar", "3658213641", "Begumpet, Hyderabad"); } public void insertValues(int custId, string custName, string custPhone, string custAdd) { string insertCommand = "Insert into CUSTOMER values ( " + custId + ",'" + custName + "','" + custPhone + "','" + custAdd + "')"; con.Open(); cmd = new SqlCommand(insertCommand, con); cmd.ExecuteNonQuery(); con.Close(); }
when am trying run this service from computer Mangement is it displaying below alert "The service on local machine started and stopped. some services stopped automatically if they have no work to do for example the performance logs and alerts service." please help me outThe reason it stopped automatically is because there is no further work for the service to do once the line
insertValue(...)
has run. In general, windows services'OnStart
method starts a thread/timer which continues to process until interupted by a Pause or Stop command. Whatever a "PL" is, he is an idiot, or you have misunderstood his request. -
i cant break my PL orders :(
-
Project Lead, sounds like a cretin who's just been promoted into management by virtue of warming the seat for X years and is out to show his minions who's boss.
Cheers, Vikram.
Recent activities: TV series: Friends, season 9 Books: Freakonomics, by Steven Levitt and Stephen J Dubner.
Carpe Diem.
-
Project Lead, sounds like a cretin who's just been promoted into management by virtue of warming the seat for X years and is out to show his minions who's boss.
Cheers, Vikram.
Recent activities: TV series: Friends, season 9 Books: Freakonomics, by Steven Levitt and Stephen J Dubner.
Carpe Diem.
Ah ok, I guess we have PM's (Project Managers) but they don't get involved with how the thing is written, or Technical Lead's which do. Hence my confusion. Anyway, he might have a valid reason for wanting to send all database communication through a windows service (ie, single point of caching) but he's obviously not been specific enough on how to communicate with this service for his more junior team members.