When you come across the error "Unable to create virtual directory" in Visual Studio. Follow steps mentioned below to create a virtual directory.
1. Go to Web Properties. (Right click on your project and select Properties or press Alt+Enter)
2. Select "Use local IIS Web server".
3. Click "Create Virtual Directory".
Following is the snapshot depicting the same.