Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nik Wahlberg 639 posts 1237 karma points MVP
    Oct 30, 2012 @ 19:24
    Nik Wahlberg
    0

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

    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)

    Any clues from you Razor rockstars? 

    Cheers,
    Nik

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Oct 30, 2012 @ 19:26
    Nik Wahlberg
    0

    Actually, the inline error reads:

    Error loading Razor Script /Shared/Slider.cshtml
    Sequence contains no matching element

    Tried republishing but no luck with that...

     

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Oct 30, 2012 @ 19:30
    Nik Wahlberg
    0

    What an amateur :) This is also running the follwing:

    Umbraco 4.9.0
    Windows 7/IIS 7 (.net 4 integrated)
    SQL Server 2008

    Cheers. 

  • De-eL 8 posts 29 karma points
    Oct 31, 2012 @ 00:40
    De-eL
    0

    Have you checked if you have all the required SQL CE dlls in your bin folder? 

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Oct 31, 2012 @ 00:54
    Nik Wahlberg
    0

    I have the following:

    - SQLCE4Umbraco.dll
    - System.Data.SqlServerCe.Entity.dll

    Do I need any others? 

    Thanks,
    Nik 

  • Craig Noble 41 posts 584 karma points c-trib
    Oct 31, 2012 @ 00:56
    Craig Noble
    0

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

  • Craig Noble 41 posts 584 karma points c-trib
    Oct 31, 2012 @ 00:58
    Craig Noble
    0

    Btw, the above may be worth the read and see if it fixes it

  • De-eL 8 posts 29 karma points
    Oct 31, 2012 @ 01:07
    De-eL
    0

    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

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Oct 31, 2012 @ 01:14
    Nik Wahlberg
    0

    De-Le, yes I have those as well. Could this be a conflict with files installed when using uBlogsy? 

  • De-eL 8 posts 29 karma points
    Oct 31, 2012 @ 01:54
    De-eL
    0

    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.

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Oct 31, 2012 @ 14:29
    Nik Wahlberg
    0

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

  • De-eL 8 posts 29 karma points
    Nov 01, 2012 @ 23:49
    De-eL
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft