Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ASP.NET Web异常-操作超时_Asp.net_Exception_Web_Timeout - Fatal编程技术网

ASP.NET Web异常-操作超时

ASP.NET Web异常-操作超时,asp.net,exception,web,timeout,Asp.net,Exception,Web,Timeout,我有一个ASPX页面,它在一个预先存在的气象站点的html表中填充一个单元格。 此aspx页面读取一个xml文件,并设置为表格单元格的框架。它需要每10秒刷新一次,以获取最新的风速和风向。 不幸的是,该应用程序遇到了超时异常(我猜-如事件日志中所述) 这是课时暂停吗?我已经调整了IIS中的应用程序池和网站,使其在24小时(1440分钟)内超时。这不是一个问题,因为weather应用程序只在我们的内部网上使用,并且只有少数(3-6)并发用户使用 原因可能是什么 以下是事件日志异常: Event T

我有一个ASPX页面,它在一个预先存在的气象站点的html表中填充一个单元格。 此aspx页面读取一个xml文件,并设置为表格单元格的框架。它需要每10秒刷新一次,以获取最新的风速和风向。 不幸的是,该应用程序遇到了超时异常(我猜-如事件日志中所述)

这是课时暂停吗?我已经调整了IIS中的应用程序池和网站,使其在24小时(1440分钟)内超时。这不是一个问题,因为weather应用程序只在我们的内部网上使用,并且只有少数(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:

您可能希望包含default.aspx中的代码,但超时似乎来自“预先存在的天气站点”,而不是来自您的intranet站点。很难确定。您可能想考虑在Debug .ASPX上设置Test/catch块以获得更详细的信息。如果它在事件日志中,则说明您的站点崩溃,您无法获得最详细的信息。如果您可以确认它是另一个站点,您可以通过几次重试来处理超时,然后返回显示“暂时不可用的信息”。

谢谢Adam, 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>

.style1
{}
$(函数(){
设置间隔(KeepSessionAlive,10000);
});
函数KeepSessionAlive(){
$.post(“/Shared/KeepSessionAlive.ashx”),null,函数(){
$(“#结果”).append(会话处于活动状态且正在启动!

); }); }

以下是父级“预先存在的天气站点”的代码: 目前的情况, .style2 { 高度:21px; 宽度:156px; } .style3 { 高度:16px;0 宽度:135px; } .style4 { 宽度:180px; } .style5 { 高度:16px; 宽度:180px; } 电流 哈德逊大桥中部的天气状况

截止时间:2014年12月6日8:38

温度: 67.3华氏度 露点: 65.5华氏度 湿度: 94% 今天的雨: 0.05英寸 风: 风暴总数: 0.05英寸 气压计: 29.733英寸,稳定 当前降雨量: 0.00in/hr

</BODY>
</HTML>

它看起来好像卡在:

System.Net.HttpWebRequest.GetResponse()

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