When you are running application in Visual Studio you are in the security of the logged in user(you), but when you are running in IIS you are in the security context of the identity of the application pool, default is Network Service, so you need make sure Network Service has access to your TNS directories or change your App Pool to run as you.
About how to grant user permissions you can refer to this link: iis7-permissions-overview-applicationpoolidentity.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.