1
votes

I am using visual studio 2012, for send email using HangFire for sending mail but it show the below error

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

the above error shows when the debugger goes to RecurringJob.AddOrUpdate(emailService => emailService.SendEmail(), "0 9 * * *"); this statement, i also try using Tools menu ->Options -> Debugging -> General -> Uncheck this option "Suppress JIT optimization on module load" but the error was not gone please help me

 protected override void OnStart(string[] args)

{

            _server = new BackgroundJobServer();

            // It will run everyday at 9:00.//
            RecurringJob.AddOrUpdate(emailService => emailService.SendEmail(), "0 9 * * *");
        }

        protected override void OnStop()
        {
           _server.Dispose();
        }

        public class EmailService
        {
            public void SendEmail()
            {
            WCFServiceInHangFire.ReportServiceClient Service = new WCFServiceInHangFire.ReportServiceClient();
                //using web services link to send email
                Service.sendEmailToAdmin();
            }
        }
1

1 Answers

0
votes

Try to reset the IIS

Open CMD as Administrator

iisreset