error minus 9996, how to solve?

I am trying to run Audacity under Windows 10, and it goes “Error opening recording device. Error code: -9996 Invalid device.”
I have switched on the “Allow apps to access your microphone” setting and still pops the same error.
What do I have to do?

Please see this page in the Manual: Error opening sound device - Audacity Manual

At the bottom of that page it says

Numeric error codes

9996 Invalid device: this means that the sound device is not valid, if it is an external sound device:
it may have been unplugged
you may have a faulty or loose connection
you may have a bad lead
the device itself may be faulty.