I downloaded the sample code for chapter 21 and got this error straight away.
An error occurred while creating a controller of type 'UnleashedBlog.Controllers.BlogController'. If the controller doesn't have a controller factory, ensure that it has a parameterless public constructor.
if you want to take a look and see if you can help me get is started. I realy want to get this going to I can see how he did things, and how it works. Thanks!!!
At my end the application crashes on the following code in BlogRepositoryBase.cs:
public IList<ArchiveInfo> ListBlogEntriesByMonth()
{
var result = from e in this.QueryBlogEntries()
group e by
new {e.DatePublished.Year, e.DatePublished.Month}
into g
orderby g.Key.Year descending, g.Key.Month descending
select new ArchiveInfo
{
Year = g.Key.Year,
Month = g.Key.Month,
Count = g.Count()
};
return result.Take(10).ToList(); // <--- Error!!!!
}
The fact that you are getting the error is because these methods are called from the base class in it's constructor.
Therefore the controller cannot be instantiated so the controller factory.
Is the Sql database which is used accessible??
Remember to mark as an answer if it helps. Let others know it contributed to a solution.
yes, it actually is using an express database there in the code. What is strange that if i down load chapter 20 code it builds and runs fine, using the same database. But the chapter 21 doesn't. very strange.
You might want to check if the connection string is properly configured. As i do not have SQL Express installed (using full SQL server) i cannot check this for you without adding features to VS2008...
Remember to mark as an answer if it helps. Let others know it contributed to a solution.
riverdayz
Member
3 Points
23 Posts
ASP.NET Framework Unleashed
Apr 07, 2010 02:51 PM|LINK
I am going through Stephen Walthers Book
ASP.NET Framework Unleashed
I downloaded the sample code for chapter 21 and got this error straight away.
An error occurred while creating a controller of type 'UnleashedBlog.Controllers.BlogController'. If the controller doesn't have a controller factory, ensure that it has a parameterless public constructor.
the code can be downloaded from here http://www.informit.com/store/product.aspx?isbn=0672329980
if you want to take a look and see if you can help me get is started. I realy want to get this going to I can see how he did things, and how it works. Thanks!!!
avsomeren
Member
185 Points
41 Posts
Re: ASP.NET Framework Unleashed
Apr 07, 2010 05:06 PM|LINK
Hi riverdayz,
I tried the code and found out the following :
At my end the application crashes on the following code in BlogRepositoryBase.cs:
public IList<ArchiveInfo> ListBlogEntriesByMonth() { var result = from e in this.QueryBlogEntries() group e by new {e.DatePublished.Year, e.DatePublished.Month} into g orderby g.Key.Year descending, g.Key.Month descending select new ArchiveInfo { Year = g.Key.Year, Month = g.Key.Month, Count = g.Count() }; return result.Take(10).ToList(); // <--- Error!!!! }The fact that you are getting the error is because these methods are called from the base class in it's constructor.
Therefore the controller cannot be instantiated so the controller factory.
Is the Sql database which is used accessible??
riverdayz
Member
3 Points
23 Posts
Re: ASP.NET Framework Unleashed
Apr 07, 2010 08:40 PM|LINK
yes, it actually is using an express database there in the code. What is strange that if i down load chapter 20 code it builds and runs fine, using the same database. But the chapter 21 doesn't. very strange.
avsomeren
Member
185 Points
41 Posts
Re: ASP.NET Framework Unleashed
Apr 08, 2010 06:21 AM|LINK
You might want to check if the connection string is properly configured. As i do not have SQL Express installed (using full SQL server) i cannot check this for you without adding features to VS2008...