ASP.NET MVC与SQL Server后端返回执行查询时,旧数据 [英] ASP.NET MVC with SQL Server backend returns old data when query is executed

查看:166
本文介绍了ASP.NET MVC与SQL Server后端返回执行查询时,旧数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的ASP.NET MVC Web应用程序有一个奇怪的问题。在VS调试模式下工作正常,但是当我把它发布到专用Web服务器(Windows 2003,IIS6)的SQL查询返回previous数据,即使底层的数据是通过相同的连接已经更新。它看起来像仿佛查询返回缓存的数据。可能是什么问题?

My ASP.NET MVC web app has a weird issue. In VS debugging mode it works as expected, but when I publish it to dedicated web server (windows 2003, IIS6) a sql query returns previous data even though underlying data was already updated through the same connection. It looks like as if a query returns cached data. What might be the problem?

推荐答案

您确定查询被再次调用?也许Web请求是由您的浏览器缓存,甚至没有重新请求到Web服务器?您可能需要设置查询时,以确保高速缓存不存在的页面上的HttpCacheability。

Are you sure the query is being called again? Perhaps the web request is being cached by your browser and not even re-requested to the web server? You may need to set the HttpCacheability on the page that the query occurs to ensure caching is not occuring.

要测试这一点,你可以告诉IE通过Tools..Internet Options..Browsing History..Settings每次重新下载。我每次访问网页时,以快速查看是否缓存问题

To test this, you can tell IE to re-download every time via Tools..Internet Options..Browsing History..Settings.."Every time I visit the webpage" in order to quickly see if caching is the issue.

这篇关于ASP.NET MVC与SQL Server后端返回执行查询时,旧数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆