Topics: Business Logic Layer, Controls, Themes
Nov 14, 2011 at 9:48 PM



I'm trying to put together an auto-provisioning process so when a user signs up, s/he gets an instance of  So let's say I have the following structure in IIS7<customer id>/blog

What I'm currently doing is that I'm creating a directory under "public/<customer id>" relative to my root and I copy and paste the whole shabang of files and directory of to that location. The problem is doesn't work (won't show up) unless and until I go to IIS manager MMC and add the public/<customer id>/blog directory as an "Application."  AFter I make the directory an application, then it works.  If I don't do that and try to browse that location, I get


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.

Source Error:

Line 7:    </configSections>
Line 8:    <BlogEngine>
Line 9:      <blogProvider defaultProvider="XmlBlogProvider">
Line 10:       <providers>
Line 11:         <add name="XmlBlogProvider" type="BlogEngine.Core.Providers.XmlBlogProvider, BlogEngine.Core"/>



I tried adding a virtual directory using "appcmd.exe add vdir blah blah" and while it says that the vertial directory has been added, the blogengine doesn't show up.  Again, but if I go to IIS7 manager and right-click and do a Add Application on that directory, everything works.

The whole point is to create an instance of the for each user so they'll isolated from each other in as much as hands-off fashion as possible.  It would have been nice if I could factor out all the common elements from all the instances and just specify the attrtibutes but for now, I can live with each having their own set of files if I can get it to work.  Any and all suggestion is apperciated and thank you in advance.  Please let me know if I can clearify anything.




Nov 15, 2011 at 6:02 AM

It's true that if you setup a whole new BE installation by copying all of the files like you are doing, then that new folder needs to be marked as an application in IIS.  It sounds like this process of creating an application works using the IIS7 manager, but doesn't work using appcmd?

One suggestion I have which you may have already considered is that with BE 2.5, it supports multiple blog instances.  Explained here.  With multiple blog instances, you only install BE one time, and within the BE control panel, you can create blog instances.  Each blog instance has its own set of data, its own users, etc.  You can also create new instances from a "template" (you can have multiple templates as well).  So you might have a single template, and you create new blog instances from that template.  The instances are pretty isolated from one another.  You can use the "virtual path" option to have one of the blog instances (aka sub-blogs) have a URL such as ~/customerid (with or without /blog at the end).  A physical directory won't be created -- instead BE will pick up on that URL (intercept it) and treat the request as being a request for that blog instance.

Or you could go the appcmd way.  I'm not sure offhand though what is differing between appcmd and the IIS7 UI manager.  I'm thinking that taking advantage of the multiple blog instances might be most ideal.

Nov 15, 2011 at 8:21 AM

Thank you Ben for you reply.  So far I tried both appcmd.exe and using the following code to create an "Application" in IIS7. 

ServerManager serverManager = new ServerManager ();

 Site site = serverManager.Sites.First(s => s.Id == 1);

 string n = "/public/" + id + "/" + "blog" ;

 Application app = site.Applications.Add(n, @"c:\\dfun\\public\\" + id + "\\blog" );

 app.ApplicationPoolName ="MyPool";



In both cases the virtual directory is created but I get a 500 error when I try to go there.  But if I use IIS7 MMC and right-click and do "Convert To Application" it works - go figure.  Event logs are clean.  The exact error message below.  Not sure what else "Convert To Application" does that other processes don't...

Any thoughts?

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

Detailed Error Information


IIS Web Core




Not yet determined

Error Code


Config Error

Cannot read configuration file

Config File


Requested URL

Physical Path


Logon Method

Not yet determined

Logon User

Not yet determined

Config Source