Dot Net下开发FTP存在的缓存策略问题

用dotnet的类库FtpWebRequest 开发应用已经不是什么新鲜话题。

在这里说的是一个怪问题,小组总共四人,两人下载文件正常,两人总是从缓存中下载文件(即便文件已经更新)。显然这是本地计算机的缓存策略在作怪,可是大家的开发环境基本一致为什么会出现不同的结果呢?

查阅了一下msdn:

Only content received using the DownloadFile command is cached.

The following table describes the effects of FTP caching policies on FtpWebRequest.

Policy

Effect

Returns the cached resource if the resource is fresh, the content length is accurate, and the expiration, modification, and content length attributes are present.

Returns the resource from the server.

Returns the cached resource if the content length is present and matches the entry size; otherwise, throws a WebException.

Returns the cached resource if the content length is provided and matches the entry size; otherwise, the resource is downloaded from the server and is returned to the caller.

Returns the cached resource if the timestamp of the cached resource is the same as the time stamp of the resource on the server; otherwise, the resource is downloaded from the server, stored in the cache, and returned to the caller.

Downloads the resource from the server, stores it in the cache, and returns the resource to the caller.

If a cached resource exists, it is deleted. The resource is downloaded from the server and is returned to the caller.

 

在ftp操作之前强制设置了一下:

FtpWebRequest.DefaultCachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.Reload);

一切OK了。估计是dotnet framework配置文件不一样导致了这个问题,配置文件是什么样的,还得继续研究....

转载于:https://www.cnblogs.com/moon2bird/archive/2008/12/29/1364706.html

相关资源:asp.net知识库
  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

表情包
插入表情
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
相关推荐
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值