3
votes

I uploaded asp.net code to C:\inetpub\wwwroot\myfolder on IIS using FTP. It won't run properly until I change the setting from IIS Manager and click "Convert to Application". Is there any way I can set it from the code itself as I dont have access to IIS Manager?

Update: exact error message:

Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

3
is it possible for you to use an installation project (msi)? - J. Ed
No, cant use msi. Just have FTP access on the server. - Aziz Shaikh
That's not FTP only. The hosting company or IT group would have to put that iis application on the target server. - bryanmac
You still have a chicken and egg problem - the code in that article is an IIS application. How do create that via FTP? And also, it has to run as administrator. See my PS: edge case above. - bryanmac

3 Answers

4
votes

You have a bit of a chicken and egg problem and very likely a permissions problem.

An IIS application defines the root of an application (which has a web.config, and can be mapped to an appppool process etc...). An IIS application maps to an IIS directory which is a physical dir or maps to a physical dir (vdir).

You are FTPing code into that directory.

The first problem is creating an IIS application also requires very elevated priviledges which even if you could execute your code after FTPing, the application pool does not likely have and should not run with those permission.

The server administrator or hosting company should create the IIS application that maps to the folder that you're FTPing into. Either that or some configuration code/script/installer needs to be run on the server interactively by an administrator.

PS: There's one edge case where it may work which is if you're FTPing into a vdir which is where you need the IIS app created but it's under a root IIS application that's mapped to an apppool which is running as a very elevated administrator on the system (ill advised and likely not the case), you make a request relative to the root which would create an IIS app on the vdir where you FTPed. Very unlikely and you wouldn't want to run in that elevated environment anyways for something that's externally facing.

3
votes

in a hosted IIS server which provides only FTP access to the customers you have no way to convert the virtual directory into an Application.

I suggest you to test your application locally in your machine running from a virtual directory instead of an IIS Application and checking what is not working.

the web.config will work anyway, there are of course some limitations like you cannot specify the application pool and your web app will run in the application pool defined for the parent application of the virtual directory, but in many cases this should be ok anyway.

Depending on your hosting company, especially if it's very cheap, they do not provide/create an app pool for every single hosted domain, you can double check this with them and ask them what are the other options for you to go.

I would try to debug and run locally as virtual directory first.

3
votes

I have found this: http://www.shabdar.org/asp-net/74-virtual-directory-not-being-configured-as-an-application-in-iis.html

in short, try to put this: <authentication mode="None" /> in your web.config and see how it works.

if still does not work and no way the hosting provider configures that site as Application, you'd better search more on google with this search string:

allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS