dotnetnuke2sxc

2SXC DNN Missing assembly System.Web.Helpers


We have just installed 2sxc on a DNN distribution and cannot create basic content. Custom apps are loading without issue, this is only occurring with the content app.

Adding a content module to a blank page with the basic content type results in the following error. This is on DNN 9 and .NET 4.8

Error: System.IO.FileLoadException: Could not load file or assembly 'System.Web.Helpers, Version=2.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) File name: 'System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   at Connect.Koi.Dnn.DetectKoiOfCurrentDnnTheme.AutoDetect()
   at Connect.Koi.Context.HttpContextState.TryToDetectTheCssFramework(IDictionary items)
   at Connect.Koi.Context.HttpContextState.get_CssFramework()
   at Connect.Koi.Dnn.DetectAndCacheDnnThemeCssFramework.AutoDetect()
   at Connect.Koi.KoiCss..ctor(Dependencies dependencies)
   at lambda_method.lambda_method(Closure , ServiceProviderEngineScope )
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
   at ToSic.Lib.DI.IServiceProviderExtensions.Build[T](IServiceProvider serviceProvider) in C:\Projects\2sxc\eav-server\ToSic.Lib.Core\DI\IServiceProviderExtensions.cs:line 26
   at ToSic.Lib.DI.IServiceProviderExtensions.Build[T](IServiceProvider serviceProvider, ILog parentLog) in C:\Projects\2sxc\eav-server\ToSic.Lib.Core\DI\IServiceProviderExtensions.cs:line 39
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at ToSic.Lib.DI.LazySvc`1.<get_Value>b__5_0() in C:\Projects\2sxc\eav-server\ToSic.Lib.Core\DI\LazySvc.cs:line 48
   at ToSic.Lib.HelpersOnce`1.Get.Get(Func`1 generator) in C:\Projects\2sxc\eav-server\ToSic.Lib.Core\Helpers\GetOnce.cs:line 37
   at ToSic.Sxc.Images.ImgResizeLinker.ImageOnly(String url, ResizeSettings settings, IHasMetadata field) in C:\Projects\2sxc\2sxc\Src\Sxc\ToSic.Sxc\Images\ImgResizeLinker.cs:line 84
   at ToSic.Sxc.Images.ResponsiveBase.<get_ThisResize>b__7_0() in C:\Projects\2sxc\2sxc\Src\Sxc\ToSic.Sxc\Images\Responsive\ResponsiveBase.cs:line 33
   at ToSic.Lib.HelpersOnce`1.Get.Get(Func`1 generator) in C:\Projects\2sxc\eav-server\ToSic.Lib.Core\Helpers\GetOnce.cs:line 37
   at ToSic.Sxc.Images.ResponsiveBase.SrcSetGenerator() in C:\Projects\2sxc\2sxc\Src\Sxc\ToSic.Sxc\Images\Responsive\ResponsiveBase.cs:line 183
   at ToSic.Lib.HelpersOnce`1.Get.Get(Func`1 generator) in C:\Projects\2sxc\eav-server\ToSic.Lib.Core\Helpers\GetOnce.cs:line 37
   at ASP._Page_Portals_68_2sxc_Content_bs5_Content_Text_and_Image_Part_Image_cshtml.Execute() in c:\home\site\wwwroot\Portals\68\2sxc\Content\bs5\Content\Text and Image.Part-Image.cshtml🎯:line 31
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
   at System.Web.WebPages.WebPageBase.<>c__DisplayClass7.<RenderPageCore>b__6(TextWriter writer)
   at System.Web.WebPages.HelperResult.ToString()
   at System.Web.WebPages.WebPageBase.Write(Object value)
   at ASP._Page_Portals_68_2sxc_Content_bs5_Content_Text_and_Image_cshtml.Execute() in c:\home\site\wwwroot\Portals\68\2sxc\Content\bs5\Content\Text and Image.cshtml🎯:line 42
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
   at ToSic.Sxc.Engines.DnnRazorEngine.Render(TextWriter writer, Object data) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Engines\Razor\DnnRazorEngine.cs:line 109 
   --- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at ToSic.Sxc.Engines.DnnRazorEngine.Render(TextWriter writer, Object data) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Engines\Razor\DnnRazorEngine.cs:line 116
   at ToSic.Sxc.Engines.DnnRazorEngine.RenderTemplate(Object data) in C:\Projects\2sxc\2sxc\Src\Dnn\ToSic.Sxc.Dnn.Razor\Engines\Razor\DnnRazorEngine.cs:line 124
   at ToSic.Sxc.Engines.EngineBase.Render(Object data) in C:\Projects\2sxc\2sxc\Src\Sxc\ToSic.Sxc\Engines\EngineBase.cs:line 178
   at ToSic.Sxc.Blocks.BlockBuilder.RenderInternal(Object data) in C:\Projects\2sxc\2sxc\Src\Sxc\ToSic.Sxc\Blocks\BlockBuilder_Render.cs:line 134 WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].```

Solution

  • Turns out another team member had changed the web.config to add the assembly, but had put it in the wrong place. Adding the assembly binding was the correct thing to do to fix the issue. Not sure if this should have happened during the 2sxc install, or if it was something weird with our DNN installation.

    Incorrect:

    <configuration>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <!-- ... -->
        </assemblyBinding>
        <dependentAssembly>
          <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
          <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
        </dependentAssembly>
      </runtime>
    </configuration>
    

    Fixed:

    <configuration>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <!-- ... -->
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    </configuration>