404 error

Topics: ASP.NET 2.0
May 2, 2008 at 8:17 PM
Newbie alert - I've tried to install the blog on 2 web sites (root dir and subfolder) but I get the 404 error:

The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /default.aspx

Thing is I can plainly see the default.aspx page in the root directory
May 2, 2008 at 10:28 PM
Is there any chance you can load Visual Studio and attach to the w3wp service? This will allow you to step through the load process and see exactly where it's failing... If you can't then you could upload your current BlogEngine folder (minus any sensitive passwords) to my ftp server and I will try and figure it out for you...

Chris
May 2, 2008 at 11:03 PM
Hey, thanks for the reply. I am trying to run the script on a domain I have hosted in my MS developer package over at 1and1.com - to the Visual Studio option is out.

Am I limited to using specific hosts with the package? Sorry about my ignorance I usually use WordPress but wanted to have blogs on my MS sites too.
May 3, 2008 at 12:02 AM
Can you give me some more background on the environment? What is the URL? Are you running in a Full/Medium Trust environment? Running at the root or under a sub-folder? Lastly, can you zip up your BlogEngine folder (after clearing out passwords) and upload it to my FTP server? I will have a look and see if there is anything wrong with the code...

Chris
May 3, 2008 at 12:10 AM
My test setup is at: http://electronika.us/

Here is what I did:
unzipped the folder and FTP'd the contents into the root directory. I just followed instructions and watched the video. Have permissions to the App_Data folder. I am just starting and would like to get it running over the weekend. I didn't get to the part where I could log in to set new user account and password.

I don't know about the trust level - I have been running classic ASP without issues on this host. This is my first .NET app running here.
May 3, 2008 at 12:16 AM
The electronika domain was just a test - I hope to have the production version at www.hpmini.com/blog/
I have the app in that directory as well with the same error.
May 3, 2008 at 12:16 AM
Can you confirm with your provider that you are running under ASP.NET 2.0 and that you have either Medium or Full Trust?
May 3, 2008 at 12:20 AM
It seems that your website isn't serving up any code. I can get to http://electronika.us/robots.txt but anything else doesn't work. If you feel comfortable enough I would be happy to connect into your host and check what configuration settings you have on the website...
May 3, 2008 at 12:23 AM
Default medium trust, it is V2 of the framework
They don't allow full trust
May 3, 2008 at 12:28 AM
Here is their .NET PR
http://order.1and1.com/xml/order/FeatureSite-buildingNet;jsessionid=7C28806AA5D43B65144BA061F98A7486.TC61a?_frame=top&__lf=Static


Anyone have this blog running on a 1and1.com hosted site?
May 3, 2008 at 12:31 AM
Can you send me the ~/web.config (sans password info) and the ~/app_data/settings.xml (sans password info) file? You can email it to me at chris@dscoduc.com...
May 3, 2008 at 12:35 AM
Sure...
but was I supposed to make any changes to web.config? It wasn't mentioned in the video or instructions.

What I have should be exactly what I extracted from the zip no?

<?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="XmlBlogProvider">
<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=MySQLServer;User ID=user;Password=password;persist security info=False;initial catalog=BlogEngine;" 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)" />
</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" />
<trust level="High" />

<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>

<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>
May 3, 2008 at 12:41 AM
Make the following changes:

(Permanant)
<machineKey
validationKey="AutoGenerate,IsolateApps"
decryptionKey="AutoGenerate,IsolateApps"
validation="SHA1" decryption="Auto"
/>

(Temporary)
<customErrors mode="Off">

(Temporary)
<trust level="Medium" />
May 3, 2008 at 12:42 AM
For clarity, don't add the (Temporary) and (Permanant) text... That's just to let you know what should stay and want is temporary
May 3, 2008 at 12:57 AM
Done - looks like same error - here is web.config again:

<?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="XmlBlogProvider">
<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=MySQLServer;User ID=user;Password=password;persist security info=False;initial catalog=BlogEngine;" 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)" />
</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" />
<trust level="Medium" />

<machineKey
validationKey="AutoGenerate,IsolateApps"
decryptionKey="AutoGenerate,IsolateApps"
validation="SHA1" decryption="Auto"
/>

<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>

<customErrors mode="Off">
<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>
May 3, 2008 at 1:02 AM
Well I would think that should work... Without actually looking at the website configuration I am at a loss... The problem doesn't immediately appear to be a BlogEngine.NET issue since I can get to http://electronika.us/robots.txt but nothing else... That steers me towards something with the application settings of the web server.

You might want to wait and see if anyone else is using this provider. If you get desperate you could let me look at the host settings myself... Other than that I don't know what else to tell you...
May 3, 2008 at 1:07 AM
OK, Thanks very much.
You have been more than generous with your time.

Not sure what you could see looking at the control panel - there are no user settings except folder permissions and DB setup.

I agree I don't think it is a BlogEngine.NET issue

I will write a simple .NET 2.0 app and push it up there to see if it works tomorrow. I'll post back my observations so others may learn.

May 3, 2008 at 12:54 PM
Edited May 3, 2008 at 12:54 PM
1and1 uses a very strange ASP.NET application setup dealing with a so-called root/redirect script else it won't pick up default.aspx as ... default page (geez)

This BlogEngine.NET user on 1&1 posted a step-by-step solution - here's a copy of his steps (which I slightly edited):
  1. Create a subfolder in your web space where you want your blog to go
  2. Point your domain (in the 1and1 domains tab) to the root (/) of your web space - that's the strange part, see the redirect script
  3. Create your application (basically the same as your asp.net application in IIS) on this subfolder
  4. Set write access to the Network Service and IUSRx user on the AppData folder
  5. Create this default.asp file in the root of your webspace which looks like this:

<%EnableSessionState=False
host = Request.ServerVariables("HTTP_HOST")
if host = "electronika.us" or host = "www.electronika.us" then
response.redirect("http://electronika.us/SubFolderAsInStep1/default.aspx")
elseif host = "example.com" or host = "www.example.com" then
response.redirect("http://example.com/SomeFolder/default.aspx")
else
response.redirect("http://electronika.us.com/error.htm")
end if
%>

If you've fixed the 404 error, but run into other hosting errors (probably security policy issues),
consider ModPack which is a fine-tuned BlogEngine.NET for shared web hosting.

Hope 1&1 customers can now (finally!) use our beloved blog platform.

Cheers,
Mike
May 3, 2008 at 5:33 PM
Thanks Mike!

I have done exactly as specified but still no go...
I am on the phone with 1and1 tech support as I type. I'll post again when it is working.
May 3, 2008 at 6:31 PM
Mike, I went ahead and installed ModPack as you suggested. I think it is going to work out ;>

I have about 100 domains on this package and each domain has its own folder (the electronika.us domain is in the electronika folder). The redirect causes the address show up like: http://electronika.us/electronika/default.aspx. I guess I can live with that but it is not exactly what I was hoping for.

I may do as lordzoltan did and simply rename it blog instead.
May 3, 2008 at 10:12 PM
Edited May 3, 2008 at 10:28 PM
Success!

My test - http://www.740fulton.net

It looks there are lots of path issues due to the redirect...
Do you guys think I should abandon the project at this point? Seems like I am in for a lot of code modifications.
May 9, 2008 at 1:32 PM
Hi Clickhouse,

What' extra step did you need to run BE.NET or ModPack on 1and1 hosting?

You'd help out our community member in this thread:
Stumped by 1and1 and many other users on that web host.

As far as your project question:

  1. Your path issues might be caused by an incorrect "VirtualPath value" - what did you set there?
  2. If 1&1 forces you to use the full subfolder path per domain, cut your losses now and find a flexible host
  3. GoDaddy uses subfolders too, but can simulate web root operation without any redirect script

With ModPack on GoDaddy, the VirtualPath value="/" so no ~tilde there.
The added value for PathFilter can strip the ugly subfolder you installed BE.NET/ModPack in.

Keep us posted please!

Cheers Mike