Installing BlogEngine.NET in an existing website

Oct 31, 2009 at 9:56 PM
Edited Nov 1, 2009 at 1:56 AM

Greetings.  I have an existing website I wrote in Visual Studio Express 2008 running under ASP.NET 3.5 and want to integrate BlogEngine.NET.  I added a sub-directory to the root and placed the downloaded BlogEngine.NET code there (v. 1.5, MSDeploy) and rebuilt the application. 

The build failed, throwing the error 'It's an error to use a section registered as allowDefinition='MachineToApplication' beyond application level'.  Many discussions suggest registering the sub-directory folder as a virtual directory in IIS, but I'm not running IIS, rather, just using the ASP.NET development server prior to uploading to my ISP hosting server.

Excluding sub-folder web.config files abates this error but results in a cascade of other errors such as unrecognized code behind files that are actually present or unresolvable namespaces and assembly references in various BlogEngine files.

Obviously I'm going about this entirely wrong, but I don't know how to proceed.  I'd certainly appreciate any suggestions!

Many thanks in advance.

Todd

Coordinator
Nov 1, 2009 at 9:07 AM

One word: IIS
<g>

The problem is that Visual Studio doesn't under sub-applications.  Your choices are ....

1.  Use IIS.

2.  Move the blog folder somewhere else, so it's not a child folder to the main application.  You would run each application separately either using 2 Visual Studio instances, or when you're done testing one application with Visual Studio, close the solution, and open the other application separately.

3.  You could merge BE into your main application, so they are one application.  This is messiest.  You would merge web.config files, merge BIN, App_Code, App_GlobalResources, App_Data folders, etc.  You could still have the blog content be in its own folder.  In this scenario, you would change the following appsetting in the web.config file to tell BE that it's running in a sub-folder.

<add key="BlogEngine.VirtualPath" value="~/blogFolder/"/>

The best option is IIS.  With IIS, you can have the main application and the blog application be in 2 separate folders (not underneath each other), but make the blog a child application of the main application within IIS.  You then tell Visual Studio to run the project using IIS instead of the built in web server.  In case you haven't seen it, I documented the steps to do this in the May 20th post in the message below.

http://blogengine.codeplex.com/Thread/View.aspx?ThreadId=20979

Nov 1, 2009 at 5:39 PM
Thanks so much Ben!  With this information and that of the post to which you refer, it has all become clear to me! Got everything running locally now.  Will see how this solution looks on the remote web server I use after some modifications.

Best Regards, Todd

BenAmada wrote:

From: BenAmada

One word: IIS
<g>

The problem is that Visual Studio doesn't under sub-applications.  Your choices are ....

1.  Use IIS.

2.  Move the blog folder somewhere else, so it's not a child folder to the main application.  You would run each application separately either using 2 Visual Studio instances, or when you're done testing one application with Visual Studio, close the solution, and open the other application separately.

3.  You could merge BE into your main application, so they are one application.  This is messiest.  You would merge web.config files, merge BIN, App_Code, App_GlobalResources, App_Data folders, etc.  You could still have the blog content be in its own folder.  In this scenario, you would change the following appsetting in the web.config file to tell BE that it's running in a sub-folder.

<add key="BlogEngine.VirtualPath" value="~/blogFolder/"/>

The best option is IIS.  With IIS, you can have the main application and the blog application be in 2 separate folders (not underneath each other), but make the blog a child application of the main application within IIS.  You then tell Visual Studio to run the project using IIS instead of the built in web server.  In case you haven't seen it, I documented the steps to do this in the May 20th post in the message below.

http://blogengine.codeplex.com/Thread/View.aspx?ThreadId=20979