0

I have working IIS7 with PHP on my computer - localhost.
I have a couple of applications that are working fine. But now I want to add a new one and for some reason I always get a 404 error on the php page. I am probably missing some basics.

What would actually be the recommended way of adding a new directory under my C:\inetpub\wwwroot (for example C:\inetpub\wwwroot\mysite) so that it appears and works under http://localhost/mysite?

Should I first copy the files to C:\inetpub\wwwroot\mysite and then create a new Application or Virtual Directory (what is actually the difference between them) under Default Web Site?

I think I have done it this way so far and it was fine, but now I have stumbled upon one site (WordPress folder structure BTW) which says Invalid application path when I try to add an Application under Default Web Site.

Actually I get Invalid application path if I try to just add an empty folder under Default Web Site, when I specify it as Physical path. Maybe that's the real problem here...?

Priednis
  • 285
  • 1
  • 3
  • 9

1 Answers1

0

Here's another post that explains the difference between a vdir and application.

In your case you just want to create the subfolder as an application. That creates a boundary between the folders (only a partial boundary).

What you've done is correct. Just create the subfolder, and if needed mark it as an application. I wonder if there is some configuration in the root folder that is seen by the subfolder. If you can in testing, temporarily rename your web.config file from the root folder and see if that resolves the issue. The settings in that file are inherited down the path structure.

I guess I should really be trying to clarify where you get the error. Is the Invalid application path error in IIS, or in the application? If it's in the IIS, then it probably has something to do with the path of the vdir. Just create it as an application, that should do the trick.

Scott Forsyth
  • 16,339
  • 3
  • 36
  • 55
  • Hi Scott, thanks for your answer and sorry for my delay in answering. I tried to repeat the steps and found out - if I create the new directory in windows explorer (under C:\Inetpub\wwwroot\[new dir]) It appears in IIS manager. There, by doing right-click on the [new dir] and "Convert to Application", In the "Add Application" dialog, If I immediately click on "Test Settings..." I get "Invalid application path". I had to specify a user in "Connect as...". If I specify myself there, then it works ok from then on. I guess adding myself there as a user is not a recommended practice. – Priednis May 19 '11 at 10:47
  • Hi Priednis, it sounds like it's permission related then. There are 3 possible users. Your app pool identity needs read permissions to the website path, or write permissions if you write anything. The website anonymous authentication account can be set to "use app pool identity" which is best if you have dedicated app pools, but if not, make sure that you grant that permission to the website path. And finally, you can use the connect as, but it's something extra to maintain so just use the app pool and anonymous users if at all possible. – Scott Forsyth May 19 '11 at 15:33
  • It is best to use a custom account for the app pool identity. It can be the applicationpoolidentity user, or you can create a new user which you can assign to the app pool plus grant permissions to disk. If you use your own user, it will have more access than it needs on disk, and a password change will break your site, so it is best practice to give a custom user for the app pool. – Scott Forsyth May 19 '11 at 15:34