Is anyone able to get output caching to work on web services?
I have followed KB 318299 which involves adding a method like the one below and calling twice within a short period of time. The second execution should use the result from the cache of first execution, but does not and executes the method a second time.
[WebMethod( CacheDuration=600 )]
public string CacheTest()
{
StringBuilder sb = new StringBuilder( "Method executed at " );
sb.Append(System.DateTime.Now.ToString());
return( sb.ToString() );
}
Result 1.....
<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://tempuri.org/">Method executed at 29/07/2004 23:16:05</string>
Result 2 ... just 2 seconds later
<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://tempuri.org/">Method executed at 29/07/2004 23:16:07</string>