我有一个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:
答案 0 :(得分:0)
您可能希望包含default.aspx中的代码,但看起来超时来自"预先存在的天气网站"不是来自您的Intranet站点。很难说清楚。您可能需要考虑在default.aspx上放置一个try / catch块以获取更详细的信息。如果它在事件日志中,您的网站崩溃了,而且您没有获得最详细的信息。如果您可以确认它是另一个站点,您可以通过几次重试来处理超时并回退到显示暂时不可用的信息"。
答案 1 :(得分:0)
谢谢亚当, 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; } 当前 哈德逊中部桥的天气状况
截至:06/12/14 8:38a<强>温度 67.3°F 的露点: 65.5°F 的湿度: 94% 今天的雨: 0.05 风: 风暴总计: 0.05 的气压计: 29.733 in and Steady 当前降雨率: 在/小时的 0.00 的
</BODY>
</HTML>
答案 2 :(得分:0)
看起来好像陷入了困境:
System.Net.HttpWebRequest.GetResponse()
所以天气现场/服务有问题。正如@ Adam47所提到的,try catch块可能会为您提供更多信息以及处理超时的方法。我希望这有帮助