Site cannot be loaded after transferred to virtual directory

iis-7virtual-directory

I have a website which is working perfectly now. The location of the website files (in my server) is at

C:\Hosting Spaces\admin\www.mysite.com

and it's accessible by URL from http://app.mysite.com

Now we're revamping the whole site, but still wants users to access the old site. So we moved the contents from

C:\Hosting Spaces\admin\www.mysite.com to C:\Hosting Spaces\admin\2014.mysite.com 

and make it accessible by virtual directory. I configured the virtual directory's alias as 2014, so the site should be accessible by going to http://app.mysite.com/2014 and the physical path as of course, C:\Hosting Spaces\admin\2014.mysite.com. I set the connect as to application user (pass through authentication), but when I want to test the connection, the problem below appear. Anyway I just click OK.

authorization problem

Now I can't access the virtual directory through http://app.mysite.com/2014, because it will always display

500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.

Please help!

Update: Another info, if I tried to access the site using the server's own IE, it returns a more descriptive error, as displayed below:

more info about error

So I tried to remove the red lines from my web.config, but it just keep displaying errors at other lines. I think if I removed all the lines, my web site won't work properly anymore

Best Answer

For the first issue you need to make sure that both the Application Pool identity and any impersonation identity have read access to the site files.

For the second issue, you need to keep in mind that web.config files in virtual directories inherit from config files in parent directories (including the root site). Some settings can override those in the root config, some can't. If you want the same comfig as the root, you can delete the config in the virtual directory. If you want to keep the one in the virtual directory, you may need to disable config inheritance. See this SO post for info about that:https://stackoverflow.com/questions/782252/avoid-web-config-inheritance-in-child-web-application-using-inheritinchildapplic .