Below piece of code will give you physical path of an IIS website.
Normally, the application gets this error when it tries to access a file that is being used or locked by some another process.
Recently I stuck in a situation where I wanted to export variable groups from my VSTS account but there was no such option to export variable group. That time I came to know that VSTS has also exposed its API. After that, I just wrote a PowerShell to download all variable groups into a JSON file by calling its API.