【问题标题】:ASP.NET Web Exception - Operation TimeoutASP.NET Web 异常 - 操作超时
【发布时间】:2014-08-22 09:18:39
【问题描述】:

我有一个 ASPX 页面,它在预先存在的 Weather 网站上的 html 表格中填充了一个单元格。 这个 aspx 页面读取一个 xml 文件并被 IFRAMED 放入表格单元格中。它需要每 10 秒刷新一次才能获得最新的风速和风向。 不幸的是,该应用程序遇到了超时异常(我认为 - 如事件日志中所述)。

这是会话超时吗?我已将 IIS 中的应用程序池和网站调整为在 24 小时(1440 分钟)内超时。这不是问题,因为天气应用程序仅在我们的 Intranet 内部使用,并且仅由少数 (3-6) 个并发用户使用。

可能是什么原因?

这里是事件日志异常:

Event Type: Warning
Event Source:   ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID:   1309
Date:       7/1/2014
Time:       1:22:08 PM
User:       N/A
Computer:   mydomain.local
Description:
Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 7/1/2014 1:22:08 PM 
Event time (UTC): 7/1/2014 5:22:08 PM 
Event ID: 5bf8561bd03c44cfae09560f02a4a495 
Event sequence: 168 
Event occurrence: 6 
Event detail code: 0 

Application information: 
Application domain: /LM/W3SVC/1/ROOT/BMBWind-9-130487080560811444 
Trust level: Full 
Application Virtual Path: /BMBWind 
Application Path: C:\inetpub\wwwroot\BMBWind\ 
Machine name: xxxx

Process information: 
Process ID: 7220 
Process name: w3wp.exe 
Account name: NT AUTHORITY\NETWORK SERVICE 

Exception information: 
Exception type: WebException 
Exception message: The operation has timed out 

Request information: 
Request URL: default.aspx 
Request path: /BMBWind/default.aspx 
User host address: 1.1.1.1 
User:  
Is authenticated: False 
Authentication Type:  
Thread account name: NT AUTHORITY\NETWORK SERVICE 

Thread information: 
Thread ID: 3 
Thread account name: NT AUTHORITY\NETWORK SERVICE 
Is impersonating: False 
Stack trace:    at System.Net.HttpWebRequest.GetResponse()
at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at _Default.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, 
Boolean     includeStagesAfterAsyncPoint)

Custom event details: 


For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Data:

【问题讨论】:

    标签: asp.net exception web timeout


    【解决方案1】:

    您可能希望包含来自 default.aspx 的代码,但看起来超时来自“预先存在的天气站点”而不是来自您的 Intranet 站点。很难确定。您可能需要考虑在您的 default.aspx 上放置一个 try/catch 块以获取更多详细信息。如果它在事件日志中,则您的站点已崩溃并且您无法获得最详细的信息。如果您可以确认它是另一个站点,您可以通过几次重试来处理超时,然后退回到显示“信息暂时不可用”。

    【讨论】:

      【解决方案2】:

      感谢亚当, default.aspx 真的很简单,包括一个简单的 KeepAlive jquery 脚本:

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org    /TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head runat="server">
        <meta http-equiv="refresh" content="10"/> 
          <title></title>
          <meta id="MetaRefresh" http-equiv="refresh" content="21600;url=Default.aspx" runat="server" />
          <style type="text/css">
          .style1
          {}
          </style>
      </head>
      
      <!-- This is a Session Keep Alive jquery script-->
      <script language="javascript" type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
              <script language="javascript" type="text/javascript">
              $(function () {
                  setInterval(KeepSessionAlive, 10000);
              });
      
              function KeepSessionAlive() {
                  $.post("/Shared/KeepSessionAlive.ashx", null, function () {
                      $("#result").append("<p>Session is alive and kicking!<p/>");
                  });
              }   
              </script>
          <div id="result"></div>
      <!-- end keep alive-->
      
      <body>
          <form id="form1" runat="server">
          <div>
              <asp:GridView ID="WeatherXML" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White"
              RowStyle-BackColor="#A1DCF2" AlternatingRowStyle-BackColor="White" AlternatingRowStyle-ForeColor="#000"
              runat="server" AutoGenerateColumns="false" AllowPaging="true">
              </asp:GridView>
              <asp:TextBox ID="txt1" runat="server" Visible="False"></asp:TextBox>
              <asp:TextBox ID="txt2" runat="server" CssClass="style1" Width="212px" 
              BackColor="Yellow" BorderColor="Yellow" BorderStyle="None" Columns="1" 
              Font-Bold="True" Font-Names="Century" Font-Size="Medium" ForeColor="Black">    </asp:TextBox>
              <iframe ID="KeepAliveFrame" src="KeepSessionAlive.aspx" frameborder="0" width="0" height="0" runat="server"></iframe>
          </div>
          </form>
      </body>
      </html>
      

      这是父“预先存在的天气网站”的代码: 的当前条件, .style2 { 高度:21px; 宽度:156px; } .style3 { 高度:16px;0 宽度:135px; } .style4 { 宽度:180px; } .style5 { 高度:16px; 宽度:180px; } 当前 Mid Hudson Bridge 的天气状况

      截至:2014 年 6 月 12 日 8:38a 温度: 67.3°F 露点: 65.5°F 湿度: 94% 今天的雨: 0.05 英寸 风: 风暴总数: 0.05 英寸 气压计: 29.733 英寸且稳定 当前降雨率: 0.00 英寸/小时
      </BODY>
      </HTML>
      

      【讨论】:

        【解决方案3】:

        看起来好像卡在了:

        System.Net.HttpWebRequest.GetResponse()

        所以是气象站点/服务有问题。正如@Adam47 所提到的,try catch 块可能会为您提供更多信息和一种处理超时的方法。我希望这会有所帮助

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-02-20
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多