Link to home
Start Free TrialLog in
Avatar of APD Toronto
APD TorontoFlag for Canada

asked on

File In Virtual Directory Not Found

Hello Experts,

I am running IIS 7.5 on Windows 7 and under my C:\inetpub\wwwroot I have two subfolders ABC and DEF representing different websites, which under IIS I have converted to applications.

within DEF I have a subfolder includes/common.asp.

Under IIS, for ABC I have created a virtual directory pointing at C:\inetpub\wwwroot\DEF\includes with the alias includes.

Now I am trying to run the following:
<!--  <!-- #include virtual = "/includes/common.asp" -->

Open in new window


But I am getting:
The include file '/includes/common.asp' was not found.

Open in new window


Any help will be greatly appreciated.
Avatar of Big Monty
Big Monty
Flag of United States of America image

few things to check:

- double check the file name and the spelling of the virtual path
- make sure the virtual path is correctly set up. can you put in the browser /includes/common.asp and see if the file shows? if not, make sure the link in the virtual folder is pointing to the proper folder on your hard drive
- you have

<!--  <!-- #include virtual = "/includes/common.asp" -->

posted above. I assume the 2 opening tags is just a typo in the post?
Avatar of APD Toronto

ASKER

When I go directly to http://localhost/DEF/includes/common.asp, I get:

HTTP/1.1 New Application Failed
since you have 2 folders under your main website, but set up as different applications, that could be the issue. did you specify ports for either one?

what is the syntax for each site that you use to access the main page?
I think it's the fact I set them up as applications, how can I undo this?
you'll need to delete them in IIS and start from scratch
I removed both applications and the HTTP/1.1 New Application Failed error disappeared, however, the first include not found still persists.

Since I removed the applications, I now see that under ABC I cannot add a Virtual Directory.
what if you create the application for ABC, set up the virtual directory, and use the syntax you were using. does that work?
I will try that, but wasn't there a "convert to web"?
i don't have an IIS 7 machine around so I can't answer that off the top of my head...I think there is, I'm just not sure where the option is.
When I try to include within the same site with the "file" keyword I get

The Include file '../includes/common.asp' cannot contain '..' to indicate the parent directory.

Can this be a permission issue?

You see, all of this worked before so I know that syntax is correct, and is working on my live environment, but this is my development machine and I needed to reformat it and now I am getting these errors.
In IIS7, Parent Paths are disabled by default. You either need to use virtual paths or turn on parent paths in IIS
OK, physical path fixed-thank you, but the original path not found to the virtual directory still has errors. I did recreate the virtual directory after removing the application.
When I go to the virtual path's properties and test connection, I get the following. Does it say something?
Picture1.png
looks like a permissions issue, try setting the NETWORK SERVICES account to have full permissions on the folder
The IIS_IUSRS has full control to ABC/includes. Is that what you mean?
nope, there is an account called NETWORK SERVICES, that is the account the runs the default application pool in IIS. If it doesnt have permissions, it'll fail.
The Network Services user is not found.
User generated image
sorry, it's NETWORK SERVICE. It's a local user account.
but, how do I add/assign it
do a search for it....in your screen shot, the word "services" is plural, it shouldnt be
OK, found network service, but when I try to grant fill control I get access denied. Yes, I am logged in as an admin.
is it the local user account, or a domain one? make sure its the local user account. other than that, i'm not sure what the issue is other than you may not have full rights
its local.  I don't have AD

As well, my IIS is on the same PC as where I am trying to browse. In other words, there is no multiple PCs
try googling "cannot add permissions for NETWORK SERVICE account"

I'm afraid I don't have much more time to work on this until tonight for you, sorry
Sorry, I misinformed you I was trying to apply full control to wwwroot, and the access denied was on the aspnet_client folder. However, my folder successfully has full control for network service.

With that said, the same error persists.
ASKER CERTIFIED SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I found something, hoping you can help me wrap it up...

As a reminder, both sites are in C:\inetpub\wwwroot\abc and C:\inetpub\wwwroot\def, and I created the virtual directory in def to point to abc, and the code failing is:

 <!-- #include virtual = "/includes/common.asp" -->

Open in new window


The reason why its failing, its looking for wwwroot/includes, and not def/includes.  Yes, I can add def, but this won't match my live environment, and  this used to work here before I reformatted.

So, the question is, how do I get /includes to point to def and not wwwroot?  Maybe, it goes back, how do I convert a folder to a website?
Got it.  Thanks for your help