Is there a way to make user logoff the session (and release the license) when user closed the published application?
Remote Application Server licenses are based on the RDP sessions on the RDSH (Remote Desktop Session Host, Terminal Service)
When all published applications are closed from the client side, the RDP session itself remains open for 20 seconds by default. During this period, the license is still consumed.
This is done so that if a user launches an other app the same session could be used and the repose time for the user is much faster.
FOr more detailed information please check the Licensing Guide
There is no way to force it using RAS settings, sorry.
You may try to set Session Time Limits using GPO as described here:
Should you want to change this amount, do the following:
NOTE: "Use Remote Apps" feature must be disabled on the each server, as this is another mechanism and will work in different way.
Go to RAS Console > right click on RD Session Hosts > Properties > Agent Settings > Publishing Session timeout. Please note that the lower amount is 20 seconds, you need to type it manually.
NOTE: You need to use this set for ALL RD Session Hosts.
For example you have set it to 1 minute, license will be released after 1 minute + couple of seconds ( slight delay caused by timeout between Publishing Agent and Licensing Server)
Also, to make sure that user closed RDP Client after he completed his work with published apps:
On the RDP Client go to Connection properties > Advanced settings> Connection Advanced settings > Connection Timeout.
For example, you may change this amount to 1. It means that once customer closes all published apps - RDP Client closes either almost immediately (after 1 second).