Тази услуга на Windows чете имейл от MSMQ. Той четеше поща, когато беше разгърнат в Windows Server 2003. След като беше преместен в Windows Server 2008, той спря да чете имейли. Той не записва никакви регистрационни файлове във файла. Когато се стартира услугата Windows, нищо не се случва.
Моля, някой може да ми каже какво може да не е наред. Трябва ли да конфигурирам/променя стойност в системния регистър в Windows Server 2008?
Ето съответния метод, при който НЕ се извършва регистриране:
public void OnStart()
// protected override void OnStart(string[] args)
{
string queuePath = ConfigurationManager.AppSettings["mqPath"];
mailFrom = ConfigurationManager.AppSettings["notificationemail"];
string SMTPSSLConfig = ConfigurationManager.AppSettings["smtpclientssl"];
if (string.IsNullOrEmpty(queuePath))
{
throw new Exception("Message queue path not defined in app.config.");
}
if (string.IsNullOrEmpty(mailFrom))
{
throw new Exception("Sender email used to send notifications is not defined in app.config.");
}
if (string.IsNullOrEmpty(SMTPSSLConfig))
{
throw new Exception("SMTP SSL config not defined in app.config.");
}
objSmtpClient = new SmtpClient();
objSmtpClient.EnableSsl = Convert.ToBoolean(SMTPSSLConfig);
//QueueService.InsureQueueExists(queuePath);
msgQ = new MessageQueue(queuePath);
msgQ.Formatter = new BinaryMessageFormatter();
msgQ.MessageReadPropertyFilter.SetAll();
msgQ.ReceiveCompleted += new ReceiveCompletedEventHandler(msgQ_ReceiveCompleted);
msgQ.BeginReceive();
try
{
if (!MessageQueue.Exists(queuePath))
{
MessageQueue.Create(queuePath);
Log.WriteMessageQueueInitialParamsLog(System.DateTime.Now.ToString()+" :Message queue successfully created at following location:"+queuePath);
}
else
{
Log.WriteMessageQueueInitialParamsLog(System.DateTime.Now.ToString() + ": Message Queue Path: " + msgQ.Path);
}
}
catch (Exception ex)
{
Log.WriteCommonLog(System.DateTime.Now.ToString() + " :Error checking message queue existence:\n"+GetExceptionMessageString(ex));
}
//eventLog1.WriteEntry(System.DateTime.Now.ToString()+" :EmailService started successfully." );
Log.WriteMessageQueueInitialParamsLog(System.DateTime.Now.ToString()+" :Message queue started successfully.");
}
Пълният код на http://pastebin.com/aiECMTVL