-
Notifications
You must be signed in to change notification settings - Fork 63
Automatic Cache Invalidation
Automatic cache invalidation is performed by a plugin named WebNotificationPlugin located in the WebNotification solution. Self-hosted_Installation_Guide_for_Portals.pdf is missing information on fully configuring the automatic invalidation process. In addition to creating a Web Notification URL record, there is a configuration needed for specifying the entities which will trigger the WebNotificationPlugin that sends the invalidation requests from the CRM to the Portal. This is done by opening the WebNotification solution, selecting the entities which the plugin will be registered on, moving them to the Send Notifications column, and clicking Save and Publish. This will register a plugin step on each of the selected entities.

If the configuration screen is completely blank with no messaging or user interface present, use a different or newer web browser.
This is documented in a couple of locations but here's a single list of steps which should get this working for you:
- Make sure that the WebNotification.axd handler is specified in the
<handlers>section of web.config - it should be there by default in the code download. - Make sure you have a Web Notification URL entity record in CRM with the full URL to the AXD web handler on the web server, for example http://myportal.com/WebNotification.axd.
- Test the web notification URL in your browser - it should come back with a response of "OK". While not a complete verification that CRM will be able to get there, this is a start.
- Open the solution named "Dynamics 365 Portals - Web Notification" in CRM. It should open on the solution configuration page which has two lists of entities.
- If there are any entities already in the list on the right hand side and you just changed the Web Notification URL, the invalidation will not work properly as these entities will have plugin steps registered with the old URL. Move these items back to the left and click the Save and Publish button.
- Move the entities you want to trigger cache invalidation from the left hand side to the right. For example if you want changes to Knowledge Articles to invalidate the cache, choose that entity, move it to the right and click Save and Publish. This will register plugin steps for create/update/delete of that entity which make calls to the AXD web handler. It's probably wise to be selective about how many entities you select here so the cache invalidations are not triggered too often, making caching useless. Bear in mind you can still manually invalidate cache for changes which are less frequent.
- Test - make a change to one of the entities you selected and save it. You should find that the portal updates to reflect the change.
- Make sure the correct web handler URL is being used - use the plugin registration tool to examine the plugin steps under Adxstudio.Xrm.Plugins.WebNotification - you should see steps for every entity you enabled in the config. Also if you look at the details of the step, the secure config includes the web notification URL. If this is not the right URL, go back to steps 4, 5 and 6.
- Verify the AXD handler is being called on the server side - Using web server logs or with ASP.NET Tracing, you should be able to see the POST requests from the plugin hitting the AXD URL on your web server and they should be getting a 200 response.