Hi there,
The user Craig Barber (Craig Barber) has changed the issue COMP-ISSUE-65
"DeliverEmail throws Exception: An asynchronous call is already in progress. It
must be completed or canceled before you can call this method.".
Here is what the user changed:
Components
from:
to: EmailSender
Description
from: If two simultaneous requests arrive for DeliverEmail, the
following Exception will be thrown.
Stack Trace:
at Castle.MonoRail.Framework.Controller.DeliverEmail(Message message)
at ... project code ... in ... project code ...
Exception: An asynchronous call is already in progress. It must be completed
or canceled before you can call this method.
Stack Trace:
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at Castle.Components.Common.EmailSender.Smtp.SmtpSender.Send(Message message)
at Castle.MonoRail.Framework.Services.MonoRailSmtpSender.Send(Message
message)
at Castle.MonoRail.Framework.Controller.DeliverEmail(Message message)
This is occurring because SmtpClient is not thread safe for an instance
variable and I *believe* the MonoRailSmtpService is used as a static member
variable. I'll need the help of someone more familiar with the system to prove
/ disprove this.
Attached is test action I used to reproduce the issue (dropped inside a
controller), patch to resolve the issue, and service I'm using until the next
release.
For other finding this issue and want a quickfix, add the attached service to
your project and override the default service in your web.config:
<service id="EmailSender" type="YourAssembly.Namespace.MonoRailSmtpSender,
YourAssembly" />
to: If two simultaneous requests arrive for DeliverEmail, the
following Exception will be thrown.
Stack Trace:
at Castle.MonoRail.Framework.Controller.DeliverEmail(Message message)
at ... project code ... in ... project code ...
Exception: An asynchronous call is already in progress. It must be completed
or canceled before you can call this method.
Stack Trace:
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at Castle.Components.Common.EmailSender.Smtp.SmtpSender.Send(Message message)
at Castle.MonoRail.Framework.Services.MonoRailSmtpSender.Send(Message
message)
at Castle.MonoRail.Framework.Controller.DeliverEmail(Message message)
This is occurring because SmtpClient is not thread safe for an instance
variable and I *believe* the MonoRailSmtpService is used as a static member
variable. I'll need the help of someone more familiar with the system to prove
/ disprove this.
Attached is test action I used to reproduce the issue (dropped inside a
controller), patch to resolve the issue, and service I'm using until the next
release.
For others finding this issue and want a quickfix, add the attached service to
your project and override the default service in your web.config:
<service id="EmailSender" type="YourAssembly.Namespace.MonoRailSmtpSender,
YourAssembly" />
For more, see
http://support.castleproject.org/projects/COMP/issues/view/COMP-ISSUE-65
--
donjon
by Castle Stronghold
http://www.castle-donjon.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Development List" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---