I created a web service in .NET and placed it in the "_layouts" folder and created Application in IIS. Somehow, the application pool of it was not the same as of SharePoint site's App Pool in which it was placed. It caused following error:
An error occurred loading a configuration file: Failed to start monitoring changes to "<your virtual directory here>" because access is denied.
Changing the App pool of the web application for the web service to the one SharePoint site had fixed the problem.