1

I have an ashx to do some sync work; it usually takes about 8 minutes. When the sync finishes, an email will be sent to admin. But when I run that ashx in browser, it keeps on loading forever after it finishes, so that admin gets more than one email.

Can anyone give me some information about why this happens?

4

1 回答 1

0

如果处理程序没有向响应返回数据,则浏览器可能正在尝试再次请求,直到获得成功状态。在这种情况下,您可以尝试响应任何文本以获取成功:

context.Response.StatusCode = 200;
context.Response.ContentType = "text/plain";
context.Response.Write(string.Empty);



但是,如果处理程序正在向响应返回数据并且响应状态码是成功的,您可以尝试在发送电子邮件后立即停止响应:

context.Response.End();
return;


并且,只是为了检查,验证您是否正在迭代一个多次调用邮件发送的循环。

于 2012-08-01T04:35:43.893 回答