I have created a windows service.
When I try to start my service after installing it on my local computer then it gives me error.
My other windows service work well only this specific service gives this error so the problem is not related to Windows but something to do with my service.
What could be wrong?
This is my Windows Service:
namespace TempWindowService
{
public partial class Service1 : ServiceBase
{
System.Threading.Thread _thread;
public Service1()
{
InitializeComponent();
}
// System.Timers.Timer tm = new System.Timers.Timer(10000);
protected override void OnStart(string[] args)
{
TempWindowService.MyServ.MyServSoapClient newService = new TempWindowService.MyServ.MyServSoapClient();
//newService.BatchProcess();
_thread = new Thread(new ThreadStart(newService.BatchProcess));
_thread.Start();
// tm.Interval = 1000;
//tm.Elapsed += new ElapsedEventHandler(TimerElapsedEvent);
// tm.AutoReset = true;
// tm.Enabled = true;
}
public void StartNew()
{
TempWindowService.MyServ.MyServSoapClient newService = new TempWindowService.MyServ.MyServSoapClient();
newService.BatchProcess();
}
private static void TimerElapsedEvent(object source, ElapsedEventArgs e)
{
}
protected override void OnStop()
{
}
}
}
I am calling the webservice from the windows service by adding service reference
This is what the error shows in EventViewer
Service cannot be started. System.InvalidOperationException: An endpoint configuration section for contract 'MyServ.MyServSoap' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name.
at System.ServiceModel.Description.ConfigLoader.LookupChannel(String configurationName, String contractName, Boolean wildcard)
What could be wrong?