我正在更新面板中使用ajax定時器控件。ASP.NET定時器僅適用於調試模式
<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>
計時器應該每秒用當前日期時間更新標籤。
protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}
一切正常,在調試模式下正常,但當我沒有調試器中運行的網站(CTRL + F5),或者如果我在現場部署到我的服務器的定時器不打勾。
但是,當我「調試=真正的」添加到Web.config一切工作正常。即使在我的服務器上。
<compilation targetFramework="4.0" debug="true">
Internet Explorer在ScriptResource.axd中引發異常「對象不支持此操作」。
我該如何解決這個問題?
編輯:我想我已經解決了它。
我不知道爲什麼,但兩件事情可以解決這個問題:
- 使用一個ScriptManager而不是ToolScriptManager
- 的使用ToolScriptManager與CombineScripts = 「假」
如果這是一個錯誤,我不知道。
也許有人可以解釋它。