Hi,
I have one requirement sending a news letter for subscribed users for every month, when admin uploads a new pdf file from the admin site. Here subscribed users are nearly 5lacks users.
So, I created a windows service for background process. When admin uploads a new pdf, click Send button then invoking Window Service and sending mails to all the users by this mail service.
This is my code in web application
private void StartServiceByName(string serviceName)
{
ServiceController serviceController = new ServiceController(serviceName);
try
{
serviceController.MachineName = ConfigurationManager.AppSettings["ServerName"];
serviceController.ServiceName = ConfigurationManager.AppSettings["ServiceName"];
serviceController.Start();
}
catch (Exception ex)
{
ExceptionLog objExceptionLog = new ExceptionLog();
objExceptionLog.SaveException(ex.ToString(), ex.Message);
if (serviceController.Status == ServiceControllerStatus.Running)
serviceController.Stop();
}
}
and in my web.config I added key also
<identity impersonate="true" />
This is working fine in my local machine when I am testing my web application, the windows service is running, and sending the mail to all the users.
But When I deployed this web application on my client server, I am getting the message
Can not open "MyService" Service on computer "MyClientComputerName"
I hosted my web application and installed my windows service on my client's same machine.
Please help me.