TBarCode .NET in an IIS 7.0 Web Farm
If you use TBarCode ASP.NET Web Control in a Web Farm you may encounter the following exception:
- Exception Type: System.ApplicationException
Message: The requested image is no longer cached.
The TBarCode ASP.NET Web Control uses the HttpContext.Cache object to store the generated barcode image. Since http requests are load balanced within a web farm it can occur that a specific Web Control receives a request for an image, which has been generated on a different application server (and therefore is not available in its local cache).
To overcome this problem you could:
- Synchronize the HttpContext.Cache object on all servers in the web farm (distributed caches). This could be done with extra programming or additional third party software.
- or simply use Client Affinity in IIS 7.0 (recommended)
Having client affinity enabled all requests are tagged with a cookie so that subsequent requests (from the same client) are routed to the same server in the web farm.
Details see Application Request Routing (3 - Configure Client Affinity)
Comments
Post a Comment
No spam please, comments are moderated.
Thanks, TEC-IT