-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An asynchronous operation cannot be started at this time #63
Comments
I'll look at this. Thanks for reporting. |
problem not solved? |
Any updates on this issue? Same problem here.. using MVC4 |
Yeah, I'm seeing this as well. |
Maybe a solution to derive from AsyncController? Not sure if there is a Base version of that class off the top of my head. |
I was looking for a good solution, couldn't find one. You can probably Sohan On Wed, Nov 7, 2012 at 8:51 AM, jamsoft notifications@github.com wrote:
|
@smsohan please see this link: http://stackoverflow.com/questions/13031144/async-keyword-and-choice-of-the-taskscheduler Please fix this problem soon. |
Thanks for this. I'll take a look at it. Sohan On Wed, Nov 7, 2012 at 10:09 AM, kiyarash notifications@github.com wrote:
|
If it looks viable, we could get together tonight or tomorrow to hack something out. Not sure if I'll have a windows VM next week. |
Ok, let's give it a shot tonight. Ping me when you are free. Sohan On Wed, Nov 7, 2012 at 10:11 AM, Tyler Mercier notifications@github.comwrote:
|
@Kiyarash @BitFlipp3r @jamsoft |
MVCMailer has problem, |
Hi Tyler, That doesn't appear to be a like for like test. I've used exactly the same code but my site is hosted in IIS and using a real mailbox, not a drop location. |
@tylermercier Just because everything works in your sample project does not mean the problem has solved. I'm doing exactly the same in my project like you did in yours and still get the error. Only difference I could see is that I'm targeting 4.5 instead of 4.0 |
Yup, this looks like a significant difference. We will try targeting .net Sent from my iPhone On 2012-11-09, at 6:37 AM, BitFlipp3r notifications@github.com wrote: @tylermercier https://github.com/tylermercier Just because everything — |
Good work guys! :) |
@jamsoft,this code(https://github.com/tylermercier/MvcApplication3) worked with a drop location Or with a real mail in sender and reciever? I do not think,are you sure? |
@BitFlipp3r @jamsoft @Kiyarash I'm sorry everyone, I didn't mean to close this. We are still trying to diagnose what the cause is and what we can do to reproduce and then fix it. Must of hit Close and Comment, instead of comment. @Kiyarash That project works for @smsohan and myself, but we didn't try sending. The issue appears to be with the HttpContext, so saving to disc or actually sending the mail shouldn't matter. Though the possibility of another issue further down the chain where actually sending fails could happen. Right now it appears the problem is with .NET 4.5 and sending async. |
FYI I'm using the following setup in web.config with smtp4dev (http://smtp4dev.codeplex.com/) for testing. smtp from="some-email@gmail.com" Edit: Had to take the opening and closing brackets out because of markdown... Works like a charm (... without asnyc :D). |
@Kiyarash I'm not sure I understand the question. Are you asking me if it works or telling me it does? @tylermercier I think we can forgive you for hitting the wrong button ... at least this time ;) But don't let me see you do it again! k! ;) |
@jamsoft yes i asked from you;) |
Any news on sending async? |
Dud you try the example project? I think we saw it worked fine in .net 4, Sent from my iPhone On 2012-12-17, at 1:16 AM, Justin Maier notifications@github.com wrote: Any news on sending async? — |
I'm using 4.5 and it doesn't work. Guessing lots of folks out there using 4.5. |
Yeah, I think for 4.5 I'd have to go for a Task based async model.Sohan On Mon, Dec 17, 2012 at 7:59 AM, michaelydavid notifications@github.comwrote:
|
@smsohan I tried the example project and the following seemed to work fine in the example and in my own MVC4 project: Task.Factory.StartNew(() => {
mail.Send();
}); It cut down the request time from 2.5s to 44ms so I'm pretty sure it works... Thanks |
@JustMaier you check that in .net 4.5? |
@Kiyarash Yes, using VS2012 with Target Framework of .NET 4.5 seems to work fine. Is it not working for you still? |
@JustMaier I have not check that yet. |
@JustMaier @Kiyarash I was having problems with both solutions in different environments. I found this: If I set If I set |
@JustMaier @topherdavis i tested your solution, we hope @smsohan fix this bug in source code with the best solution. |
@Kiyarash To get SendAsync to work I had to target framework 4.0. I didn't have to include the configuration if the machine didn't have 4.5 installed at all. The task based, as far as I know, will only work if you are targeting 4.5. |
@topherdavis yes,SendAsync work in framework 4.0 BUT not in 4.5. anyway, "we hope @smsohan fix this bug in source code with the best solution". |
@smsohan @tylermercier @JustMaier @topherdavis @BitFlipp3r I think this issue solved when i marked action with public async Task<ActionResult> Send(User info)
{
// ...
// send email
await _userMailer.SendEmail(new EmailM{ Email = info.Email, UserName = info.UserName })
.SendAsync();
// ...
return Json(new { IsSuccess = "true" });
} What is your opinion? |
If you are awaiting, then you may as well use Send, the synchronous call. On Sat, Apr 6, 2013 at 12:53 AM, kiarash notifications@github.com wrote:
|
Hi, when i want send mail Async in my controller with SendAsync method i get to this error:
System.InvalidOperationException
An asynchronous operation cannot be started at this time. Asynchronous operations may only be started within an asynchronous handler or module or during certain events in the Page lifecycle. If this exception occurred while executing a Page, ensure that the Page is marked <%@ Page Async="true" %>.
i use MVC4.
why?
The text was updated successfully, but these errors were encountered: