【转】关于arcgis server ADF的几种超时

我发现下面的提示英文的很不爽:
session has timed out from extended inactivity
a new session must be started to use this application by closing this brower and reopening
于是搜了下
知道了arcgis server ADF的超时问题
ADF的超时分为三种
■一种是adf控件的超时,纯客户端的超时,而且只和adf控件的js有关系
也就是如果你的adf控件在客户端没有被操作达到一定时间后的timeout,与adf控件无关的其他操作不受影响,而且不经过adf的js与server通讯也不受影响。
结果就是提示我上面列出的内容,这种超时是在aspnet_client\ESRI\WebADF\JavaScript\display_common.js 第990行设定的
var maximumLapseTime = 10; // Change this value to session timeout in minutes
提示信息也在这个js文件中,showLapseAlert() 这个函数负责
这种超时应该小于等于ASP.NET 自身的超时,显然,要是大于了,server端都超时了,client端还怎么混啊。
如果想修改这种超时,只需要重写这两个地方,但是要在display_common.js 加载之后的地方再重写一遍,比如写在<html>标签之后
重写了showLapseAlert()就能不提示那一堆鸟语了
如果想禁用这种超时, 
var maximumLapseTime = Infinity;

■一种是ASP.NET 自身的超时 ,就是我们平常接触的asp的20分钟session超时,不介绍了
在web.config中加个<sessionState timeout="10"/>就可以改了
■一种是数据源超时,纯服务器端的
在arcgis server 设置中使用非池化的时候,一个asp.net的session在创建的时候arcgis server就会创建 server context,这种超时就是server context的寿命,数据源超时应该和asp.net的session一样,否则可能在一个session期间server context就会死掉,还得重新创建
怎么修改呢?我不会,反正是在地图服务器那里设置
非池化模式下的超时问题。。我也没看懂
以下是英文原版
------------------------------------------------------------------------------------------------------------------
Timeout settings in the Web ADF


There are three timeouts to consider when using a Web ADF application: Web ADF timeout (client-tier), ASP.NET session timeout (Web-tier), data source timeout (server-tier).   The relationships between the different timeout values and where they apply is important to understand.  

The Web ADF timeout is only used by the browser.  The ASP.NET session is not aware of the client timeout, however both the client and Web-tier timeouts are designed to work together.  The Web ADF timeout gives you the ability to use browser logic to provide the end-user with information about timeout details, without requiring an additional request to the Web server.  This is important in an asynchronous communication environment (such as AJAX-enabled Web ADF controls) where you want to intercept a callback to a Web application session that no longer exists.  In general, the Web ADF timeout is designed for the end user while the ASP.NET session timeout is necessary from a Web application perspective to dispose of resources.  With this in mind, the Web ADF timeout can be the same or less than the ASP.NET session timeout.  In most cases, they should be the same. 

The data source timeout is usually necessary to control erroneous requests to services to make sure system resources are available and utilized appropriately.   Timeout values are relative and depend on service requirements.  Since most requests to services in the Web ADF are stateless, ASP.NET session timeout does not play a part.  However, if a connection to a service is persistent across requests, the relationship between ASP.NET session timeouts and data source timeouts may need to be considered.  In the case of ArcGIS Server local connections to non-pooled services, server context can be created once at the beginning of a session and maintained (persisted) for the duration of the session.  If the "maximum use" timeout on the ArcGIS Server service is less than the session timeout, it is possible that server context will need to be recreated.        

1) The Web ADF timeout is set in the display_common.js file on the following line:
var maximumLapseTime = 10;


The timeout value is in minutes. Note that by default, the display_common.js file is embedded as a Web resource in Web ADF controls and streamed to a browser at runtime.  The default value is set to 10 minutes.  In order to change this value for a Web ADF application, you need to change the maximumLapseTime variable after the display_common.js file is loaded.   In the Web page add the following script tag and variable setting in the form that contains Web ADF controls: 
<script language="javascript" type="text/javascript">
  var maximumLapseTime = 20;
</script>


At runtime, the display_common.js content will be loaded inline at the beginning of the form.  Adding this script tag will override the maximumLapseTime variable setting in display_common.js.   To disable the Web ADF timeout, set the maximumLapseTime variable to Infinity:


<script language="javascript" type="text/javascript">
  var maximumLapseTime = Infinity;
</script>


To change the message returned after the timeout is reached "override" the showLapseAlert() JavaScript function. "Override" in this sense means define the showLapseAlert() JavaScript function after the function in display_common.js.  For example, include this at the end of the aspx page:


<script language="javascript" type="text/javascript">
  function showLapseAlert()
  {
    alert("Application has timed out. Reloading.");
    window.location.reload();
  }
</script>


Note that this also triggers a page reload via JavaScript.


2) The ASP.NET session timeout can be set in the web.config file. By default, it is set to 20 minutes. To change the timeout for a Web application, add the following to your web.config, within <system.web>:

<sessionState timeout="10"/>


3) A data source timeout is managed by the data source provider. For example, ArcIMS administrators have the ability to change the time alloted for a spatial server to process a request.  ArcGIS Server administrators can change the usage time alloted for an individual service.  Administration documentation for specific data sources may provide additional details on timeout management at this level.

posted @ 2009-12-11 11:27  AooYu  阅读(587)  评论(0编辑  收藏  举报