WebMethod 中的 CacheDuration 被忽略
我尝试缓存 Web 服务的 webmethod 。通过遵循文档,我尝试添加 CacheDuration 属性,并进行了测试:
[WebMethod(CacheDuration = 180)]
public int TestCacheDuration()
{
return new Random().Next();
}
对于 webmethod 的每次调用,我都有不同的响应,因此不会缓存它。
正常吗?
感谢您的回答!
I try to cache a webmethod of a webservice. By following the documentation, I have tried to add the CacheDuration
attribute, and made a test :
[WebMethod(CacheDuration = 180)]
public int TestCacheDuration()
{
return new Random().Next();
}
For each call of the webmethod, I have a different response, so it is not cached.
Is it normal ?
Thanks for your answers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MSDN论坛对此有明确的解释:
还有:
来源:http://social.msdn.microsoft.com/forums/en-US/asmxandxml/thread/3765f1e2-0ff5-4840-afa2-e85b3d909cd1
This is clearly explained in MSDN forums:
and also:
source: http://social.msdn.microsoft.com/forums/en-US/asmxandxml/thread/3765f1e2-0ff5-4840-afa2-e85b3d909cd1