Error during startup: A route named 'Site' could not be found in the route collection.

Aug 25, 2009 at 8:13 PM
Edited Aug 25, 2009 at 8:15 PM

While debugging, I found out, that the real error is inside OxiteApplication.cs, Application_BeginRequest method:

setupUrl = new UrlHelper(new RequestContext(new HttpContextWrapper(Context), new RouteData())).Site();

"HttpContextWrapper The type 'System.Web.HttpContextWrapper' exists in both 'System.Web.dll' and 'System.Web.Abstractions.dll'"

Any suggestions are welcomed!

Coordinator
Aug 25, 2009 at 8:38 PM

This usually means Oxite couldn't connect to your database.  We'll be rearranging some things so a more accurate error is given in the near future.

Aug 25, 2009 at 8:51 PM

Erik,

I've changed connection string to use SQL authentication with SQL user and I've tried to connect with this user via SQL Management Studio - it's works with no problem. Any other possible causes?

Coordinator
Aug 25, 2009 at 8:59 PM

You restarted Oxite and it still doesn't work?  You're probably going to have to put a breakpoint in Application_Start in OxiteApplication.cs and see what's throwing the error (something is dying before the app can properly start).

Aug 25, 2009 at 9:34 PM

Yep, that's right. It still doesn't work. While debuging it's dying inside Application_BeginRequest method as pointed in the first post.

Coordinator
Aug 25, 2009 at 10:01 PM

Oops, sorry...misread your first post there.  hhhmmm...I believe HttpContextWrapper and all that was moved into System.Web (and System.Web.Abstractions is no longer needed) in .NET 4.0.  Do you have .NET 4.0 installed on your box?  I'm guessing it's getting confused where to get that class from.  We haven't tested with .NET 4.0 yet so you're treading in new waters.

Not completely sure how to help you since I haven't tried Oxite with .NET 4.0 yet (assuming that IS the problem), but you might want to try messing with the assembly references to make sure you're not having a conflict.

Aug 26, 2009 at 7:09 AM

The most interesting thing - NO, I'm running .NET Framework 3.5 SP1. Any ideas?

Coordinator
Aug 26, 2009 at 7:19 AM

hhhmmm...not really.  :-\  Run "Clean Solution" in Visual Studio???  Remove the reference to System.Web.Abstractions???  Really haven't seen this one before.  You don't get an error at compile time?

Aug 26, 2009 at 6:41 PM

Finally! I've found the cause. I deployed Database not by using SQL script, but directly from the Database project. It seems, that Database project generates deployment script with errors (some variable are defined more than once). As a result the DB information was not inserted correctly and the blog didn't work.

The question is how can it be, that exception is related to the Routes and the inner exception to the HttpContextWrapper...

Coordinator
Aug 26, 2009 at 9:23 PM

Ah, yah...the DB project isn't meant to generate anything deployable.  It's just used for creating a local instance.  Weird, I know, but yah, don't use that.  You can always do a schema/data compare of the MDF file in App_Data.

Yah, I have no idea about the HttpContextWrapper error.  Again, haven't ever seen that one.  The relation to routes is that Application_Start failed so certain things never got loaded (like the registration of all the routes), but since the app has already started, the next request tries to run but can't because none of the routes were ever registered.

Glad you got it working!

Aug 26, 2009 at 9:37 PM

Thanks Erik for support!

Are you guys planning opening Oxite team for the external contributors?

Coordinator
Aug 26, 2009 at 11:46 PM

We already have a couple external contributors.  :)  We're always looking for contributors that bring a lot to the table.  If interested, the best way to become a contributor is to get our attention.  Build cool stuff with Oxite, blog about it (on Oxite of course), etc.  We're watching.  :)