The LocalDB needs user profile to be loaded. Therefore, you will not be able to use the LocalDB on IIS as the worker process by default does note have the user profile.
However, there seems to be some workarounds although I do not know if they can help you:
Using LocalDB with Full IIS, Part 1: User Profile
https://learn.microsoft.com/en-us/archive/blogs/sqlexpress/using-localdb-with-full-iis-part-1-user-profile
Using LocalDB with Full IIS, Part 2: Instance Ownership
https://learn.microsoft.com/en-us/archive/blogs/sqlexpress/using-localdb-with-full-iis-part-2-instance-ownership