allowDefinition='MachineToApplication'

Topics: ASP.NET 2.0
Jun 23, 2007 at 4:28 PM
I have the blog set up and humming on my staging machine. There are some minor issues (logged elsewhere here) so it may not be 100%, but I can add posts and do most things so I think it's fine. It's set in a subdirectory of my Classic ASP site, running on IIS7 / Windows Vista.

I themed-up the blog and uninstalled/ installed it a couple of times to check I have it down. That's all good.

I thought I'd start shifting the rest of the site to ASP.NET, but I want to keep the BlogEngine application as a subdirectory.

So I start up Visual Web Developer Express and Build the site (before changing anything). Immeidately it tells me:
>Error 102 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.
E:\websites\powder\BlogEngine\Web.Config 11

The offending line (11) is:
<blogProvider defaultProvider="XmlBlogProvider">

I googled around, and also fiddled around and created my own top-level web.config, but that doesn't fix it. The directory is designated as a directory, but what does the "allow definition" thing mean? I guess someone else is running this as a subdirectory, in which case perhaps you've been here... I don't want to start tinkering with my own pages until I've got this error off my screen.

thanks in advance...

Jun 24, 2007 at 2:54 AM
Did you actually create the directory as a virtual application? What version of .NET did you specify for that directory?

If you aren't using .NET at the top level then don't put a web.config there and just keep one in that folder but make sure its an application. Right click the folder properties and check what tabs are available, look to see where it shows the web.config being loaded from - it should be your blog root.

I just removed that line ;)

-c
Jun 24, 2007 at 9:31 AM
Yes, the directory and the blog stuff are all fine. .NET is 2.0.50727.42 ... You can't actually tell it what to use in IIS7 as far as I can tell. But that should be enough, no?

I am using .NET at the top level, hence the problem.

With the application the paths are as you'd expect: pointing at the root of the blog. The only thing I can tweak with the application seems to be "application pool", which doesn't look like the right thing to mess with. Hmm. On the plus side, everything else seems t work.