ASP.NET定时器只能在调试模式 [英] ASP.NET Timer only works in debug mode
问题描述
我使用的更新面板内的AJAX定时器控制。
I am using the ajax timer control inside an update panel.
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick"></asp:Timer>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
定时器应该更新标签每秒当前日期时间。
The timer should update the label every second with the current datetime.
protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}
一切工作正常,在调试模式,但是当我运行的网站没有调试器(Ctrl + F5),或者如果我在现场部署到我的服务器的定时器不打勾。
Everything works fine in debug mode but when I run the site without debugger (CTRL+F5) or if I deploy the site to my server the timer does not tick.
但是当我添加调试=真正的到web.config一切工作正常。即使在我的服务器。
But when I add "debug=true" to the web.config everything works fine. Even on my server.
<compilation targetFramework="4.0" debug="true">
Internet Explorer中抛出异常对象不支持此操作中的ScriptResource.axd。
Internet Explorer throws the exception "Object doesn't support this action" in ScriptResource.axd.
我该如何解决这个问题呢?
How can I solve this issue?
编辑:我想我已经解决了它
我不知道为什么,但两件事情可以解决这个问题:
I don't know why but two things can solve this issue:
- 使用,而不是ToolScriptManager 一个ScriptManager
- 使用ToolScriptManager与CombineScripts =假
- Using a ScriptManager instead of a ToolScriptManager
- Using the ToolScriptManager with CombineScripts="false"
我不知道这是否是一个错误或没有。
I have no clue if this is a bug or not.
也许有人可以解释它。
推荐答案
似乎有在最新的AJAX控件工具包中的错误 - 我刚刚遇到这个错误我自己 - 这似乎是唯一的选择就是降级到previous版本。
There seems to be a bug in the latest AJAX Control Toolkit - I have just come across this error myself - It seems the only option is to downgrade to a previous version.
的https://ajaxcontroltoolkit.$c$cplex.com/workitem/27639 和http://forums.asp.net/t/1962717.aspx?Timer+and+Script+Combining+w+ToolkitScriptManager
要解决当前的问题,我有在调试模式下运行,直到我可以降级和测试。
to fix the current issue i am having to run in debug mode until i can downgrade and test.
这篇关于ASP.NET定时器只能在调试模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!