Copied to clipboard

Flag this post as spam?

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


  • limin 27 posts 149 karma points
    Mar 30, 2021 @ 17:14
    limin
    0

    Could not load file or assembly

    I am using Umbraco 8, and .net framework 4.7.2, I have a site running correctly on my local, but when I publish it to my server, I got error as

    Could not load file or assembly 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    on server, it has .net framework 4.7.2, it has System.Web.WebPages.Razor.dll in my bin folder , its version is 3.0.7. Also , I cleared files in Temporary ASP.NET Files, and I don't see in my code something is accessing System.Web.WebPages.Razor, Version=1.0.0.0

    Can someone help me find out what the problem is?

    Thanks

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Mar 30, 2021 @ 19:02
    Alex Skrypnyk
    1

    Hi

    Try to reinstall MVC in your solution and redeploy -

    Update-Package Microsoft.AspNet.Mvc -Reinstall
    

    Alex

  • limin 27 posts 149 karma points
    Mar 30, 2021 @ 19:11
    limin
    0

    thanks, I ran the command and it was successful: Successfully installed 'Microsoft.AspNet.Mvc 5.2.7'

    then I published again, it didn't help, the error message stayed same

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Mar 30, 2021 @ 19:20
    Alex Skrypnyk
    0

    Check that you installed the asp.net MVC at least version 3 on the server

  • limin 27 posts 149 karma points
    Mar 30, 2021 @ 20:08
    limin
    0

    in my project, in NuGet management , the package Microsoft.AspNet.Mvc, it is version, 5.2.7.

    on file system on my local, the "System.Web.Mvc.dll" has version 5.2.7-61128 same as the "System.Web.Mvc.dll" on the server

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Mar 30, 2021 @ 21:34
    Alex Skrypnyk
    0

    Did you install MVC on the web server?

  • limin 27 posts 149 karma points
    Mar 30, 2021 @ 21:36
    limin
    0

    hmmmm, I didn't, I don't know. what does it mean to install MVC on server? do I need to run some installation application? Thanks

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Mar 30, 2021 @ 21:39
    Alex Skrypnyk
    0

    Check all these dlls :

    * Microsoft.Web.Infrastructure
    * System.Web.Razor
    * System.Web.WebPages.Deployment
    * System.Web.WebPages.Razor
    
  • limin 27 posts 149 karma points
    Mar 30, 2021 @ 21:45
    limin
    0

    yes I have all these 4 .dll files on local and on server in \bin folder. For each file, time stamp, size, and product version are the same between my local and on server

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Mar 30, 2021 @ 21:53
    Alex Skrypnyk
    0

    what ASP.NET version installed on the server? Medium Trust?

  • limin 27 posts 149 karma points
    Mar 30, 2021 @ 22:48
    limin
    0

    ASP.NET version on server is 4.7.2, just installed last week, 2021-03-27. I am not sure how to check Trust level, but I would think it is at correct level.

  • Huw Reddick 1737 posts 6098 karma points MVP c-trib
    Mar 31, 2021 @ 08:24
    Huw Reddick
    0

    Is your AppPool set to use the correct version of .Net? It is also possible that .Net is not correctly registered in IIS

  • limin 27 posts 149 karma points
    Mar 31, 2021 @ 15:54
    limin
    0

    AppPool is using .Net 4.0.40319, there is no option to choose 4.7.2, all my other AppPools are all on 4.0.40319 although the sites are on 4.5.

    I am not sure how to check whether .Net correctly registered in IIS. This website is an existing one, it was working before on old Umbraco version, we updated it to new Umbraco 8.

  • Huw Reddick 1737 posts 6098 karma points MVP c-trib
    Mar 31, 2021 @ 18:58
    Huw Reddick
    0

    Sounds like it should be setup ok, you could try adding a binding redirect for the assembly in your web.config

  • limin 27 posts 149 karma points
    Mar 31, 2021 @ 19:23
    limin
    0

    in Views\web.config, I have this

    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
    

    and I have error message as I mentioned in my first post

    -* - * - * - -* - * - * - -* - * - * - -* - * - * - -* - * - * -

    then I added binding direct in root\web.config, see attached imageenter image description here

    then I got different error message as :

    Attempt by security transparent method 'Microsoft.Web.Helpers.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)' failed.

  • limin 27 posts 149 karma points
    Mar 31, 2021 @ 19:29
    limin
    0

    I am just running a basic Umbraco 8 site, using Visual Studio 2017, published to server from within VS.

    I tried different projects, In one I made the base project with the MVC folders included, the other I didn't - they both failed the same way.

  • Huw Reddick 1737 posts 6098 karma points MVP c-trib
    Mar 31, 2021 @ 19:55
    Huw Reddick
    0

    Definitely sounds like something odd on the server, is your umbraco published to an app folder in another site or its own website in iis?

  • limin 27 posts 149 karma points
    Mar 31, 2021 @ 20:03
    limin
    0

    It is its own website

  • Huw Reddick 1737 posts 6098 karma points MVP c-trib
    Mar 31, 2021 @ 21:12
    Huw Reddick
    0

    Did you install any other nuget packages other than umbraco for your Vs project? Dou get any build errors or warnings in VS when you build it?

  • limin 27 posts 149 karma points
    Mar 31, 2021 @ 21:18
    limin
    0

    I didn't install other nuget packages , only the umbracocms, and I don't have build warning and error when I built it, it ran correctly on my local.

  • Huw Reddick 1737 posts 6098 karma points MVP c-trib
    Mar 31, 2021 @ 21:30
    Huw Reddick
    0

    As a test, could you try publishing to a local folder and comparing the files to those on the server to see if anything is different.

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Mar 31, 2021 @ 21:41
    Alex Skrypnyk
    0

    something with the server

    try to reset asp net setup

  • limin 27 posts 149 karma points
    Mar 31, 2021 @ 22:08
    limin
    1

    I think it is server issue too, so at this point, I will put a pause on this and try different direction, thank you very much for all your help!

  • Huw Reddick 1737 posts 6098 karma points MVP c-trib
    Apr 01, 2021 @ 05:56
    Huw Reddick
    0

    Try using aspnet_regiis to reinstall .net into your site

Please Sign in or register to post replies

Write your reply to:

Draft