As is well known, I'm an XSLT Rebel, but am trying my hand at Razor for a project. I'm having this strange issue where the site does not run my Razor scripts outside of debug mode within VS. If I install the site in IIS 7, I get the following errors (taken from umbdebugshowtrace).
Exception occurred while populating cache, Will set RazorDataTypeModelTypes to null so that this error remains visible and you don't end up with an empty cache with silent failure. 0.564591658995766 0.021581
The exception was System.Exception and the message was Unable to load one or more of the types in assembly 'SQLCE4Umbraco, Version=1.0.4633.18690, Culture=neutral, PublicKeyToken=null'. Exceptions were thrown:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.. at umbraco.BusinessLogic.Utils.TypeFinder.FindClassesMarkedWithAttribute(Assembly assembly, Type attribute)
at umbraco.BusinessLogic.Utils.TypeFinder.FindClassesMarkedWithAttribute(Type attribute)
at umbraco.MacroEngines.DynamicNode.TryGetMember(GetMemberBinder binder, Object& result)
Just in case someone else this problem, here's what I did wrong . . .
When I transferred the database from my dev environment to the live environment I use the SQL Server Export/Import tool.
This tool only transfers the data and creates the 'basic' tables, but does not create primary/foriegn keys and identity fields, etc so my data was a bit of a mess :(
I had to use the 'Generate Scripts' tool (right click on database in SSMS and it's under the 'tasks' menu) to create the tables correctly, without the foriegn keys.
I then used the tool again to transfer just the data (Without blowing any foriegn key contraints as they haven't been created).
Then I ran the tool a third time to create the missing foriegn keys.
BTW - I also used SQL Data Compare (Redgate tool) to make sure the databases were in sync).
What's the version of System.Data.SqlServerCe.dll in your bin folder? The SQLCE4Umbraco.dll that you have seems to be looking out for v4.0.0.1. It could be as you said, conflicting versions.
No luck replacing the DLLs in there. Now I seem to have a slightly different error:
Error Loading Razor Script (file: macroSlider) Sequence contains no matching element at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
at ASP._Page_macroScripts_Shared_Slider_cshtml.Execute() in e:\Code\[site]\SiteBuilder\macroScripts\Shared\Slider.cshtml:line 8
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors)
at System.Web.WebPages.WebPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)
at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)
Line 8 = var homeFeatures = siteDataChildren.First(x => x.NodeTypeAlias =="HomepageFeatures");
I triple checked the permissions (Network Service FULL on all, just to be sure).
This is different from previous error. Looking at your code snippet, you are trying to retrieve the first element from a potentially empty list / sequence. You might want to check the nodeTypeAlias' spelling, upper / lower case and if you can't guarantee that there would be at least one document in that DocType, use .FirstOrDefault instead. It will then return a null when nothing is matched.
Razor error loading script
Hi community,
As is well known, I'm an XSLT Rebel, but am trying my hand at Razor for a project. I'm having this strange issue where the site does not run my Razor scripts outside of debug mode within VS. If I install the site in IIS 7, I get the following errors (taken from umbdebugshowtrace).
Any clues from you Razor rockstars?
Cheers,
Nik
Actually, the inline error reads:
Tried republishing but no luck with that...
What an amateur :) This is also running the follwing:
Umbraco 4.9.0
Windows 7/IIS 7 (.net 4 integrated)
SQL Server 2008
Cheers.
Have you checked if you have all the required SQL CE dlls in your bin folder?
I have the following:
- SQLCE4Umbraco.dll
- System.Data.SqlServerCe.Entity.dll
Do I need any others?
Thanks,
Nik
Read this:
"
Just in case someone else this problem, here's what I did wrong . . .
When I transferred the database from my dev environment to the live environment I use the SQL Server Export/Import tool.
This tool only transfers the data and creates the 'basic' tables, but does not create primary/foriegn keys and identity fields, etc so my data was a bit of a mess :(
I had to use the 'Generate Scripts' tool (right click on database in SSMS and it's under the 'tasks' menu) to create the tables correctly, without the foriegn keys.
I then used the tool again to transfer just the data (Without blowing any foriegn key contraints as they haven't been created).
Then I ran the tool a third time to create the missing foriegn keys.
BTW - I also used SQL Data Compare (Redgate tool) to make sure the databases were in sync).
Hope it helps !
"
Source: http://our.umbraco.org/m?mode=topic&id=28254
Give that a go :)
Btw, the above may be worth the read and see if it fixes it
You need to have the amd64 and x86 folders as well, check this out http://our.umbraco.org/wiki/install-and-setup/using-sql-ce-4-with-umbraco-46
De-Le, yes I have those as well. Could this be a conflict with files installed when using uBlogsy?
What's the version of System.Data.SqlServerCe.dll in your bin folder? The SQLCE4Umbraco.dll that you have seems to be looking out for v4.0.0.1. It could be as you said, conflicting versions.
No luck replacing the DLLs in there. Now I seem to have a slightly different error:
Line 8 = var homeFeatures = siteDataChildren.First(x => x.NodeTypeAlias == "HomepageFeatures");
I triple checked the permissions (Network Service FULL on all, just to be sure).
This is different from previous error. Looking at your code snippet, you are trying to retrieve the first element from a potentially empty list / sequence. You might want to check the nodeTypeAlias' spelling, upper / lower case and if you can't guarantee that there would be at least one document in that DocType, use .FirstOrDefault instead. It will then return a null when nothing is matched.
is working on a reply...