本文介绍了(求助)ASP.NET:BUG? Webform在100分钟后进行回发。为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 怎么了?我的webform在100分钟后自行执行回发。 我创建了一个非常简单的表格,用于测试日志文件。 I在浏览器中打开网站,单击按钮并关闭浏览器(脚本在没有浏览器输出的服务器上运行)。 Button1_Click事件运行循环120分钟。 日志给我 Form1:加载 Button1_Click:开始 100分钟后,IIS会自行回发。 最终日志是: Form1:加载 Button1_Click:开始 Form1:加载 Button1_Click:开始 Button1_Click:结束永不到了。 我几个月前在一个需要几个小时才能从网络服务中获取一些数据的表格上注意到这种行为。 有没有人有想法? 我没有更改程序或IIS6或web.config中的任何内容。 我尝试了什么: timeoutcheck.aspx <%@ Page Language =VBAutoEventWireup =false CodeFile =timeoutcheck.aspx.vbInherits =_ timeoutcheck%> <!DOCTYPE html> < html xmlns =http://www.w3.org/1999/xhtml> < body> < form id =form1runat =server> < p><%= Date.Now.ToString()%>< / p> < p>< asp:Button runat =serverID =Button1Text =Start/>< / p> < p>< asp:Button runat =serverID =Button2Text =Dummy/>< / p> < / form> < / body> < / html> timeoutcheck.aspx.vb: 部分 类 _timeoutcheck 继承 System.Web.UI.Page 私有 Sub form1_Load (发件人作为 对象,e 作为 EventArgs )句柄 form1.Load DoLog( Form_Load) 结束 Sub 私有 Sub Button1_Click(发件人正如 对象,e As EventArgs)句柄 Button1.Click Dim dStart As 日期 = 日期。现在 昏暗 timeoutMinutes 作为 整数 = 120 DoLog( Button1_Click:Start) 日期。现在< dStart.AddMinutes(timeoutMinutes) ' foo 循环 DoLog( Button1_Click:End) 结束 Sub 私有 Sub DoLog(messageInfo As String ) Dim subject As String = Timeoutcheck(& HttpContext.Current.Session。 SessionID& ) Dim message As 新列表( 字符串)来自{ ####& subject, messageInfo, Date .Now.ToString()& 。& 日期 .Now.Millisecond, Postback :& IsPostBack, 发送:& 如果(Request.UrlReferrer , - ,Request.UrlReferrer.ToString()), Environment.StackTrace, -------------- } 使用 stmWriter = 新 System.IO.StreamWriter(服务器.MapPath( 〜/ timeoutcheck.log), True ) stmWriter.WriteLine( String .Join(vbCrLf,message.ToArray())) stmWriter.Close() 结束 使用 结束 Sub 结束 类 解决方案 可能已经解决了。 更改了web.config: < compilation debug =falsetargetFramework =4.7> to < compilation debug = true targetFramework =4.7> 此选项会将执行超时覆盖为无限。 之后检查我将更改回false并设置httpruntime执行超时和其他参数。 来源: debug-true-in-web-config-bad-thing What's wrong? My webform is performing a postback after 100 minutes by itself.I created a very simple form for testing with a log file.I open the website in the browser, click the button and close the browser (script runs on the server without browser output).The Button1_Click event runs a loop for 120 minutes.The log gives me Form1: LoadButton1_Click: StartAfter 100 minutes IIS does a postback itself.Final log is:Form1: LoadButton1_Click: StartForm1: LoadButton1_Click: StartThe Button1_Click:End is never reached.I noticed this behaviour some months ago on a form which needs some hours to fetch some data from a webservice. Does anyone have an idea? I haven't change anything in the procecure or IIS6 or web.config.What I have tried:timeoutcheck.aspx<%@ Page Language="VB" AutoEventWireup="false" CodeFile="timeoutcheck.aspx.vb" Inherits="_timeoutcheck" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><body> <form id="form1" runat="server"> <p><%=Date.Now.ToString() %></p> <p><asp:Button runat="server" ID="Button1" Text="Start" /></p> <p><asp:Button runat="server" ID="Button2" Text="Dummy" /></p> </form></body></html>timeoutcheck.aspx.vb:Partial Class _timeoutcheck Inherits System.Web.UI.Page Private Sub form1_Load(sender As Object, e As EventArgs) Handles form1.Load DoLog("Form_Load") End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim dStart As Date = Date.Now Dim timeoutMinutes As Integer = 120 DoLog("Button1_Click:Start") Do While Date.Now < dStart.AddMinutes(timeoutMinutes) 'foo Loop DoLog("Button1_Click:End") End Sub Private Sub DoLog(messageInfo As String) Dim subject As String = "Timeoutcheck (" & HttpContext.Current.Session.SessionID & ")" Dim message As New List(Of String) From { "#### " & subject, messageInfo, Date.Now.ToString() & "." & Date.Now.Millisecond, "Postback: " & IsPostBack, "Send: " & If(Request.UrlReferrer Is Nothing, "--", Request.UrlReferrer.ToString()), Environment.StackTrace, "--------------" } Using stmWriter = New System.IO.StreamWriter(Server.MapPath("~/timeoutcheck.log"), True) stmWriter.WriteLine(String.Join(vbCrLf, message.ToArray())) stmWriter.Close() End Using End SubEnd Class 解决方案 probably solved. Changed web.config:<compilation debug="false" targetFramework="4.7">to<compilation debug="true" targetFramework="4.7">This option overrides the execution timeout to infinite.After checks I'll change back to false and set httpruntime execute timeout and other parameter.Source:debug-true-in-web-config-bad-thing 这篇关于(求助)ASP.NET:BUG? Webform在100分钟后进行回发。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-27 06:43