Setting up BE with MSSQL

Topics: ASP.NET 2.0
Feb 5, 2008 at 9:42 AM
Hi all.

After setting up my installation for MSSQL I'm getting the following error when I browse default.aspx:

----- 8< -----
Server Error in '/' Application.
--------------------------------------------------------------------------------

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not find a part of the path 'C:\Websites\blog.localhost\AppData\users.xml'.

Source Error:

Line 74: <providers>
Line 75: <clear />
Line 76: <add name="XmlRoleProvider" type="BlogEngine.Core.Providers.XmlRoleProvider, BlogEngine.Core" description="XML role provider" xmlFileName="~/App_Data/roles.xml"/>
Line 77: </providers>
Line 78: </roleManager>

Source File: C:\Websites\blog.localhost\web.config Line: 76

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
----- >8 -----

Does anyone know why BE is looking for 'C:\Websites\blog.localhost\AppData\users.xml' if I have specified MSSQL as my datasource? Also, it looks like it's trying to open '\AppData\users.xml' rather than '\App_Data\users.xml' - very strange!

Any help greatly appreciated.

Ben
Coordinator
Feb 5, 2008 at 1:46 PM
Hi Ben,

The SQL provider will store posts, pages, and settings in SQL Server. If you'd like to move the membership and roles to SQL Server you can as well, but you'll need to setup the SQL Membership and Roles as well.

You may find these screencasts helpful.

http://www.nyveldt.com/blog/post/Using-the-BlogEngineNET-SQL-Server-Provider-Screencast.aspx
http://www.nyveldt.com/blog/post/BlogEngineNET-Screencast-SQL-Membership-and-Roles-Providers.aspx

Al
Coordinator
Feb 5, 2008 at 1:46 PM
Edited Feb 5, 2008 at 1:46 PM
Removed duplicate message.
Feb 5, 2008 at 5:33 PM
Hi Razor.

Thanks for the reply, however I wasn't really aiming to use SQL as the membership provider (although this seems the logical thing to do...)

I get the error as soon as I change the web.config to use SQL server for the blogging:

<blogProvider defaultProvider="MSSQLBlogProvider"

As soon as I save & refresh I get the following:

Parser Error Message: Could not find a part of the path 'C:\Inetpub\wwwroot\blogengine\AppData\users.xml'.

Source Error:


Line 73: <providers>
Line 74: <clear />
Line 75: <add name="XmlRoleProvider" type="BlogEngine.Core.Providers.XmlRoleProvider, BlogEngine.Core" description="XML role provider" xmlFileName="~/App_Data/roles.xml"/>
Line 76: </providers>
Line 77: </roleManager>

Any ideas why it might be looking for the path 'C:\Inetpub\wwwroot\blogengine\AppData\users.xml' when the folder is clearly, "App_Data" ?

Many thanks,

Ben
Feb 10, 2008 at 2:28 PM
1st. Does the application works in Visual Studio (with the ASP.NET web server, not IIS)?
If it is YES, so you have a problem with IIS, remove virtual directory and create a new pointing to your working directory.
2nd. If the application does not work in Visual Studio you need to download new code from blogengine source code, and try again.
Feb 10, 2008 at 7:50 PM
I had the exact same error message, as soon as I switched to MSSQL.

My - I admit, lazy - solution was to remove the line adding the XMLRoleProvider alltogether, since BE wasn't going to use it anyway.
Since then no more errors occured, and the blog works just fine. Although I have no idea wat caused the error.

regards,
Peter.


Feb 11, 2008 at 11:50 AM
Ok, here is my web.config file. I use BlogEngine with SQL 2005 only for post, pages, and others. But membership and role providers is XML, and works.
{
<?xml version="1.0"?>
<configuration>

<configSections>
<sectionGroup name="BlogEngine">
<section name="blogProvider" requirePermission="false" type="BlogEngine.Core.Providers.BlogProviderSection, BlogEngine.Core" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>
</sectionGroup>
</configSections>

<BlogEngine>
<blogProvider defaultProvider="MSSQLBlogProvider">
<providers>
<add name="XmlBlogProvider" type="BlogEngine.Core.Providers.XmlBlogProvider, BlogEngine.Core"/>
<add name="MSSQLBlogProvider" type="BlogEngine.Core.Providers.MSSQLBlogProvider, BlogEngine.Core"/>
</providers>
</blogProvider>
</BlogEngine>


<!-- configSource is not implemented in Mono.
<connectionStrings configSource="sql.config" />
-->

<connectionStrings>
<clear/>
<add name="LocalSqlServer" connectionString="dummy"/> <!-- Mono complains if LocalSqlServer isn't specified -->

<add name="BlogEngine" connectionString="data source=localhost;Integrated Security=SSPI;Initial Catalog=BE" providerName="System.Data.SqlClient"/>

</connectionStrings>

<appSettings>
<add key="BlogEngine.FileExtension" value=".aspx" />
<!-- You can e.g. use "~/blog/" if BlogEngine.NET is not located in the root of the application -->
<add key="BlogEngine.VirtualPath" value="~/" />
<!-- The regex used to identify mobile devices so a different theme can be shown -->
<add key="BlogEngine.MobileDevices" value="(nokia|sonyericsson|blackberry|samsung|sec-|windows ce|motorola|mot-|up.b)" />
<!-- The name of the role with administrator permissions -->
<add key="BlogEngine.AdminRole" value="Administrators" />
</appSettings>

<system.web>

<compilation debug="true" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="auto" uiCulture="auto" />
<httpRuntime enableVersionHeader="false" useFullyQualifiedRedirectUrl="true" maxRequestLength="16384" executionTimeout="3600" requestLengthDiskThreshold="16384" />

<machineKey
validationKey="D9F7287EFDE8DF4CAFF79011D5308643D8F62AE10CDF30DAB640B7399BF6C57B0269D60A23FBCCC736FC2487ED695512BA95044DE4C58DC02C2BA0C4A266454C"
decryptionKey="BDAAF7E00B69BA47B37EEAC328929A06A6647D4C89FED3A7D5C52B12B23680F4"
validation="SHA1" decryption="AES"
/>

<authentication mode="Forms">
<forms timeout="129600" name=".AUXBLOGENGINE" protection="All" slidingExpiration="true" loginUrl="~/login.aspx" cookieless="UseCookies" />
</authentication>

<pages enableSessionState="false" enableViewStateMac="true" enableEventValidation="true">
<controls>
<add namespace="Controls" tagPrefix="blog"/>
</controls>
</pages>

<!-- Tiene que estar en Off para hosting, sino en RemoteOnly -->
<customErrors mode="RemoteOnly">
<error statusCode="404" redirect="~/error404.aspx" />
</customErrors>

<membership defaultProvider="XmlMembershipProvider" >
<providers>
<clear />
<add name="XmlMembershipProvider" type="BlogEngine.Core.Providers.XmlMembershipProvider, BlogEngine.Core" description="XML membership provider" xmlFileName="~/App_Data/users.xml"/>
</providers>
</membership>

<roleManager defaultProvider="XmlRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".BLOGENGINEROLES">
<providers>
<clear />
<add name="XmlRoleProvider" type="BlogEngine.Core.Providers.XmlRoleProvider, BlogEngine.Core" description="XML role provider" xmlFileName="~/App_Data/roles.xml"/>
</providers>
</roleManager>

<siteMap defaultProvider="PageSiteMap" enabled="true" >
<providers>
<add name="PageSiteMap" description="The site map provider that reads in the .sitemap XML files." type="BlogEngine.Core.Web.Controls.PageSiteMap, BlogEngine.Core"/>
<add name="SecuritySiteMap" description="Used for authenticated users." type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" securityTrimmingEnabled="true" siteMapFile="Web.sitemap" />
</providers>
</siteMap>

<httpModules>
<add name="WwwSubDomainModule" type="BlogEngine.Core.Web.HttpModules.WwwSubDomainModule, BlogEngine.Core"/>
<add name="UrlRewrite" type="BlogEngine.Core.Web.HttpModules.UrlRewrite, BlogEngine.Core"/>
<add name="CompressionModule" type="BlogEngine.Core.Web.HttpModules.CompressionModule, BlogEngine.Core"/>
<add name="ReferrerModule" type="BlogEngine.Core.Web.HttpModules.ReferrerModule, BlogEngine.Core"/>
<!--The CleanPageModule below removes whitespace which makes the page load faster in IE. Enable at own risk -->
<!--<add name="CleanPageModule" type="BlogEngine.Core.Web.HttpModules.CleanPageModule, BlogEngine.Core"/>-->

<!--Remove the default ASP.NET modules we don't need-->
<remove name="PassportAuthentication" />
<remove name="Profile" />
<remove name="AnonymousIdentification" />
</httpModules>

<httpHandlers>
<add verb="*" path="file.axd" type="BlogEngine.Core.Web.HttpHandlers.FileHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="image.axd" type="BlogEngine.Core.Web.HttpHandlers.ImageHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="syndication.axd" type="BlogEngine.Core.Web.HttpHandlers.SyndicationHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="sitemap.axd" type="BlogEngine.Core.Web.HttpHandlers.SiteMap, BlogEngine.Core" validate="false"/>
<add verb="*" path="trackback.axd" type="BlogEngine.Core.Web.HttpHandlers.TrackbackHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="pingback.axd" type="BlogEngine.Core.Web.HttpHandlers.PingbackHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="opensearch.axd" type="BlogEngine.Core.Web.HttpHandlers.OpenSearchHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="metaweblog.axd" type="BlogEngine.Core.API.MetaWeblog.MetaWeblogHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="rsd.axd" type="BlogEngine.Core.Web.HttpHandlers.RsdHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="css.axd" type="BlogEngine.Core.Web.HttpHandlers.CssHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="js.axd" type="BlogEngine.Core.Web.HttpHandlers.JavaScriptHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="rating.axd" type="BlogEngine.Core.Web.HttpHandlers.RatingHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="opml.axd" type="BlogEngine.Core.Web.HttpHandlers.OpmlHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="monster.axd" type="BlogEngine.Core.Web.HttpHandlers.MonsterHandler, BlogEngine.Core" validate="false"/>
<add verb="*" path="blogml.axd" type="BlogEngine.Core.Web.HttpHandlers.BlogMLExportHandler, BlogEngine.Core" validate="false"/>
</httpHandlers>

</system.web>
</configuration>
}

Julio.
Feb 13, 2008 at 8:02 PM
Hi all.

Well, I got it working finally... took ages to figure it out but I jtentor's advice and got the source code and stepped through... it revelaed that my StorageLocation had an incorrect path in it; appdata not app_data - so, my apologies to all... it wasn't BE but me being a dick when hacking the MSSQL setup script - argh!

Thanks again for the responses and the video tutrials, etc.

Cheers,

Ben