2sic / 2sxc

DNN + 2sxc = #DNNCMS - This tool helps web designers and developers prepare great looking content in DNN (DotNetNuke). It's like mixing DNN with Umbraco and Drupal :)
http://2sxc.org
MIT License
145 stars 40 forks source link

Upgrading to 9.43.1 fails related to System.Web.Helpers #1751

Closed jeremy-farrance closed 5 years ago

jeremy-farrance commented 5 years ago

I'm submitting a bug report about upgrading/general.

Current behavior When I upgrade a DNN 9.2.2 or 9.3.x with 2sxc 9.4x+ to 9.43.1 specifically, I soon get errors related to System.Web.Helpers.

In one case I got the classic, "DNN Error, Return to Site" and this was the URL (note the "AntiForgery" https://staging123.accuraty.ws/Default.aspx?tabid=59&error=The+type+initializer+for+%27System.Web.Helpers.AntiForgery%27+threw+an+exception.&content=0

Other times I get an IIS Error 500

Then when I get on the server (local) I get a detailed IIS/.NET error explaining that System.Web.Helpers has a method being requested but if found the wrong version of the DLL in the bin (paraphrasing since I didn't save that one, sorry).

ALSO NOTE THIS IS EASY TO FIX by just adding the following to web.config:

  <runtime>
<!-- other stuff -->
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>

In each case it was not there at all until I added it.

Expected behavior Upgrade should just work.

Minimal reproduction of the problem with instructions I think I covered this well above.

Windows Server 2016/IIS, all patches and updates, latest .NET but no install of .NET Core anything

2sxc version(s): 9.2+ upgrading to 9.43.1 Browser: all but probably not relevant DNN: 9.2+ and 9.3+ Language: any

iJungleboy commented 5 years ago

thanks for the report with fix! We'll look into it.

jeremy-farrance commented 5 years ago

If its any help in eliminating causes, I just upgraded a DNN 8.00.04 from 2sxc 9.33 to 9.43.1 and this problem didn't come up. But it supports my experience that this only seems to happen on DNN 9.02 and 9.03+.

iJungleboy commented 5 years ago

@Accuraty thanks for the update

jeremy-farrance commented 5 years ago

I was wrong. Upgraded a DNN 8.00.04 to 9.43.1 and now when I try to add a Content module to the page I immediately get the follow error in the Razor file. I did confirm the skin has a koi.json properly in the root of the skin.

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.Dnn.Koi.DnnSkinFile.AutoDetect() at Connect.Koi.Context.HttpContextState.TryToDetectTheCssFramework() at Connect.Koi.Context.HttpContextState.get_CssFramework() at Connect.Koi.Context.ToolsForCurrentState.get_Css() at Connect.Koi.Koi.get_IsUnknown() at ASP._Page_Portals_0_2sxc_Content__Shared___Koi_Admin_Messages_cshtml.Execute() in c:\HostingSpaces\path\domain.com\www\Portals\0\2sxc\Content\_Shared - Koi Admin Messages.cshtml:line 8 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.WebPageBase.Write(HelperResult result) at ASP._Page_Portals_0_2sxc_Content__Shared___Assets_cshtml.Execute() in c:\HostingSpaces\path\domain.com\www\Portals\0\2sxc\Content\_Shared - Assets.cshtml:line 2 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.

jeremy-farrance commented 5 years ago

Oh, and again, easily fixed with the web.config addition mentioned above (bindingRedirect).

iJungleboy commented 5 years ago

Found out that this is a DNN bug! See https://github.com/dnnsoftware/Dnn.Platform/issues/2971 It only happens if a DNN is updated from a 7 or 8.0.x. Otherwise this never happens.