When trying to create excel files while exporting and you need to save it on the folder inside a web server. Often times you get an error like this :
means that your websites application pool doesn’t have the rights to Read or Write into the folder that the website’s located. To fix it, you need to check the website’s ApplicationPool by opening the IIS Manger (simply press Windows+R and type inetmgr) look for the websites select it and click Basic Settings inside the right sidebar.
Now, remember the name of the Application Pool that is used. After that, go to the website’s folder and set proper Permissions for the application pool. Since iis automaticaly create a virtual account with the same name for every application pool that was created and run the worker process under this account, that means we need to set the folder’s permission for the application pool. As shown in the picture below, set the permission for IIS AppPoolAuthSite then check the proper permissions (Write, Read, Execute etc) inside the security tab. Then restart the website, and it should work fine now.