![]() In order to force the WebClient to initiate each call without cache, we added a random number to the REST-URL. The catch is that changing this setting did not actually disable the caching in our case. ![]() WebClient.CachePolicy = new (.NoCacheNoStore) įileData = webClient.DownloadData(restUrl) The WebClient has a setting for its caching behavior and disabling can be done as per code below. We ended up disabling caching on both the WebClient and the API level as I will demonstrate below. The first step was to locate which caching system was causing the issue, it could be the WebClient calling the API, the API itself (ASP.NET Core MVC) or the unlikely case of IIS caching. As something that seemed like a quick fix, required quite a workaround to bypass the caching system. However, for some reason, the API would always return the old data, or so it seemed.Ĭlearly somewhere, some cache was being read instead of the actual API data. From our MVC application we initiated a GET-call using the WebClient to our newly developed API, which would then process some data in the API backend and return the latest metric-data. While in the process of steadily moving our ASP.NET MVC application from the monolith structure to a microservices architecture, we ran into an issue when we tried to call our first ASP.NET Core API microservice. ![]() Like when you keep getting the old data from an API even though the underlying data has been updated. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |