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

Fix Error System.Web.Helpers after initializing the basic bs3 and bs4 content apps. #1595

Closed Sorencys closed 5 years ago

Sorencys commented 6 years ago

I'm submitting a bug report about other / unknown

Current behavior Directly after initializing the basic bs3 and bs4 content apps this error occurs.

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_20_2sxc_ContentShared___Koi_Admin_Messages_cshtml.Execute() in c:\inetpub\vhosts\website.com\httpdocs\Portals\20\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.<>cDisplayClass7.b6(TextWriter writer) at System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) at System.Web.WebPages.WebPageBase.Write(HelperResult result) at ASP._Page_Portals_20_2sxc_Content_SharedAssets_cshtml.Execute() in c:\inetpub\vhosts\website.com\httpdocs\Portals\20\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.<>cDisplayClass7.b6(TextWriter writer) at System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) at System.Web.WebPages.WebPageBase.Write(HelperResult result) at ASP._Page_Portals_20_2sxc_Content__Image___max_1_cshtml.Execute() in c:\inetpub\vhosts\website.com\httpdocs\Portals\20\2sxc\Content_Image - max 1.cshtml:line 9 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at ToSic.SexyContent.Engines.RazorEngine.Render(TextWriter writer) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\RazorEngine.cs:line 65 at ToSic.SexyContent.Engines.RazorEngine.RenderTemplate() in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\RazorEngine.cs:line 92 at ToSic.SexyContent.Engines.EngineBase.Render() in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\ToSic.Sxc\SexyContent\Engines\EngineBase.cs:line 92 at ToSic.SexyContent.SxcInstance.Render() in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\ToSic.Sxc\SexyContent\SxcInstance_Render.cs:line 58 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].

The koi.json is in place and pointing to bs3.

Expected behavior To be able to use the content apps.

Minimal reproduction of the problem with instructions If necessery we can grant you temporarily access.

What is the motivation / use case for changing the behavior? We need to be able to use the content apps.

iJungleboy commented 6 years ago

Just back from vacation. It's apparently a DLL version missmatch or something like that. Since you're the first and only person reporting this, I presume it's something specific to your installation - like multiple extensions adding different versions of this file. Can you reproduce this on a clean DNN install, or does it only happen if another specific module is installed?

perezandres commented 6 years ago

I have that same error, and I don't have a clue about why. It seems specific to this DNN installation, but the funny fact is that the issue is only in one site; another site in the same DNN installation is working well, same content type & template.

iJungleboy commented 6 years ago

Maybe you who experience this could try to corner it more - maybe the skin is introducing something (a web.config?) or the portal folder. Could you try various things like switching skins, removing a bunch of stuff etc.?

My guess is btw that it's some web.config somewhere, because that could affect DLL bindings for code within that area.

perezandres commented 6 years ago

I was able to get rid of that error just adding a missing key in web.config:

What I still can't understand is why a module in another site of this same DNN installation, same template & content type, was working ¿?

iJungleboy commented 6 years ago

@perezandres I don't see what you changed (not showing in this git) could you post that again?

perezandres commented 6 years ago

I'm sorry, I pasted the text but it was gone after I submitted my reply :-( I guess I forgot to insert it as code. Again: `

`

iJungleboy commented 6 years ago

@perezandres thanks. and did you do this in the root web.config, or in the one in the portals/x/2sxc folder?

perezandres commented 6 years ago

In root web.config. I didn't know about the portal web.config. Should I use it instead?

iJungleboy commented 6 years ago

basically the web-configs inherit each other. so if the problem occurs only on certain subfolders (certain portals) and not on others, then usually the path leading to there must have some web.config which changes it. Now I have no idea which one it is on your system, but because you have the issue on one portal and not another, I would at least check to try to find out where the problem web.config resides, and how it got there.

perezandres commented 6 years ago

Well, I've checked both portal's web.config and they're exactly the same. And one more "funny" fact: in the portal which was throwing the error, a couple of icons (see image below) are gone (they've actually been changed by some blinking icon) in all modules of the page where 2sxc module is.

menu icons 2sxc

iJungleboy commented 6 years ago

@perezandres my guess is that you have some kind of rewrites or css which load multiple times. you would see that with F12 in your browser...

Tychodewaard commented 6 years ago

I ran into this today as well. What is different from most of my other instances:

Tychodewaard commented 6 years ago

In the console no errors but some user messages that mention errors. Find them below. BTW Adding the rule that @perezandres mentioned to the web.config, made the module work like it should be. Hope this helps as 'input' :-)

Cms.Api(i3) - log was reset Cms.Api(i3)Cmd.Exec(iq) - detecting params and running - has 4 params Cms.Api(i3)Cmd.Exec(iq) - might cycle parameters, in case not all were given. third is event=undefined Cms.Api(i3)Cmd.Exec(iq) - adapting settings; name is string: true; name = layout Cms.Api(i3)Cmd.Exec(iq) - adapting settings; name is string: false; name = [object Object] Cms.Api(i3)Cmd.Exec(iq) - will add defaults for layout from buttonConfig Cms.Api(i3)Cmd.Exec(iq) - run command layout for type undefined Cms.Api(i3)Cmd.Exec(iq) - button.dialog method missing, must be old implementation which used the action-name - generating method Cms.Api(i3)Cmd.Exec(iq) - simple button without code - generating code to open standard dialog Cms.Api(i3)Cmd.Exec(iq) - just a UI command, will not run pre-flight to ensure content-block - now running the code

20:06:33.278 /desktopmodules/tosic_sexycontent/dist/ng/main.bundle.js?sxcver=9.32.1.40885:1 platform destroy error Error: The platform has already been destroyed! at e.destroy (/desktopmodules/tosic_sexycontent/dist/ng/vendor.bundle.js?sxcver=9.32.1.40885:1) at dt (/desktopmodules/tosic_sexycontent/dist/ng/main.bundle.js?sxcver=9.32.1.40885:1) at e._next (/desktopmodules/tosic_sexycontent/dist/ng/main.bundle.js?sxcver=9.32.1.40885:1) at e.__tryOrSetError (/desktopmodules/tosic_sexycontent/dist/ng/vendor.bundle.js?sxcver=9.32.1.40885:1) at e.next (/desktopmodules/tosic_sexycontent/dist/ng/vendor.bundle.js?sxcver=9.32.1.40885:1) at e._next (/desktopmodules/tosic_sexycontent/dist/ng/vendor.bundle.js?sxcver=9.32.1.40885:1) at e.next (/desktopmodules/tosic_sexycontent/dist/ng/vendor.bundle.js?sxcver=9.32.1.40885:1) at e._next (/desktopmodules/tosic_sexycontent/dist/ng/vendor.bundle.js?sxcver=9.32.1.40885:1) at e.next (/desktopmodules/tosic_sexycontent/dist/ng/vendor.bundle.js?sxcver=9.32.1.40885:1) at e.debouncedNext (/desktopmodules/tosic_sexycontent/dist/ng/vendor.bundle.js?sxcver=9.32.1.40885:1)

Tychodewaard commented 6 years ago

@perezandres I detected the funky DNN module icons as well. Nothing in the console that could explain it (to me) Strange thing I noticed is that without a 2SXCmodule on the page it looks fine. When you add the content module initially both show the correct DNN icons. Just after reloading the black pencil icon and the move icon are replaced with blinkign exclamation marks alternating with question marks

iJungleboy commented 6 years ago

@perezandres could your icon-issue be related to #1623 ?

Tychodewaard commented 6 years ago

@iJungleboy Is the missing tag in the web.config something that needs following up? I never ran into this before. If it is typical for DNN instances that have been upgraded from DNN7 and after the upgrade 2SXC installed, I think it is important to get even more people using 2SXC. It all starts with flawless installation of the module.

iJungleboy commented 6 years ago

@Tychodewaard I completely agree. Could you tell me in which web.config this is missing? is it the root, or the one in the 2sxc folder? Once we have that we can look into it.

Tychodewaard commented 6 years ago

The root. At least I added the tag in the root web.cnfig and the error disappeared.

perezandres commented 6 years ago

@perezandres could your icon-issue be related to #1623 ?

I don't know, but I'm not using Porto. In fact, both portals have the same theme (though different skin files). As soon as I have a free minute, I'll check it slowly... Last months are being crazy :-(

iJungleboy commented 5 years ago

I ran into the same problem now on my dev-system. Not sure yet what's causing it, as I only have it on certain apps/portals on my dev. I changed my "local" web.config in the portals/###/2sxc folder to this

<?xml version="1.0"?>

<configuration>
  <configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor">
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor" requirePermission="false" />
    </sectionGroup>
  </configSections>

  <system.web.webPages.razor>
    <pages pageBaseType="ToSic.SexyContent.Razor.SexyContentWebPage">
      <namespaces>
        <!--<add namespace="Microsoft.Web.Helpers" />
        <add namespace="WebMatrix.Data" />-->
      </namespaces>
    </pages>
  </system.web.webPages.razor>

  <system.web>
    <compilation>
        <assemblies>
        <!-- 2dm 2018-11-04 trying to fix the System.Object not found issue -->
         <add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"/> 
        <!-- 2dm 2018-11-04 end -->
        </assemblies>
    </compilation>
  </system.web>
</configuration>

to fix it.

This is not a long-term solution, but should help people who run into this.

Tychodewaard commented 5 years ago

Some new info on this. I get this error after a buggy install. The install ran into problems as the content security policy did not allow the frame that is used for installing the templates.

The security headers and csp (that I don't have on other sites) : `

    <add name="X-XSS-Protection" value="1; mode=block" />
    <add name="X-Content-Type-Options" value="nosniff" />
    <add name="Referrer-Policy" value="same-origin" />
    <add name="Feature-Policy" value="payment 'none'" />
    <add name="Strict-Transport-Security" value="max-age=31536000" />
    <remove name="X-XSS-Protection" />
    <remove name="X-Frame-Options" />
    <add name="X-XSS-Protection" value="1; mode=block" />
    <add name="Content-Security-Policy" value="default-src 'self' http://fonts.gstatic.com https://maxcdn.bootstrapcdn.com/font-awesome/ ; script-src 'self' 'unsafe-inline' 
    'unsafe-eval' https://api.instagram.com https://code.jquery.com https://stats.g.doubleclick.net https://www.google-analytics.com https://www.googletagmanager.com https://*.twitter.com https://apis.google.com/js/plusone.js https://platform.linkedin.com/in.js https://static.ak.fbcdn.net https://cdn.syndication.twimg.com ; connect-src 'self'; style-src 'self' 'unsafe-inline' http://fonts.googleapis.com https://maxcdn.bootstrapcdn.com; img-src * data: ; media-src 'none' ; object-src 'self' ; frame-src https://gettingstarted.2sxc.org/ 'self' https://www.youtube.com https://i.s-microsoft.com https://platform.twitter.com  https://syndication.twitter.com/;" />

`

iJungleboy commented 5 years ago

This sounds confusing. If I understand @Tychodewaard right, DNN had an issue with it's dialogs, and didn't completely install everything. Is this correct?

Tychodewaard commented 5 years ago

I think so. As I inherited the install, I'm not sure how old it is. What I have done:

  1. Install the module.
  2. Add the content module to a page, this did not go well as it was blocked bij de csp.
  3. I added https://gettingstarted.2sxc.org/ csp installing looked fine but adding a content module to the page, created the error the same as the original issue.
  4. the app module did not install because https://2sxc.org/ was not in the csp. I added that to the csp and installed the News app. That looked fine but threw another error (simular but different)
  5. Tried to do the trick you described above with web.config. Did not fix it
  6. I followed the steps on http://swisschecklist.com/en/i4k4hhqo/2Sexy-Content-Solve-configuration-error-after-upgrading-to-DotNetNuke-7 And what I saw is that the folder /Portals/_default/2sexy does not exist

Should that folder still exist or is that deprecated?

iJungleboy commented 5 years ago

@Tychodewaard what's csp? That folder "2sexy" is a very old folder name - it's not used anymore. everything is "2sxc" now.

Tychodewaard commented 5 years ago

csp is the content security policy that is in the web.config (in the root of the install. The part that was blocking looks like: <add name="Content-Security-Policy" frame-src 'self' https://www.youtube.com https://i.s-microsoft.com https://platform.twitter.com https://syndication.twitter.com/;" /> This did not contain https://2sxc.org/ and https://gettingstarted.2sxc.org/

The error of the App module : Error: System.Exception: Configuration Error: Please follow this checklist to solve the problem: http://swisschecklist.com/en/i4k4hhqo/2Sexy-Content-Solve-configuration-error-after-upgrading-to-DotNetNuke-7 ---> System.Configuration.ConfigurationErrorsException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. (C:\Inetpub\vhosts\customer.nl\httpdocs\portals\0\2sxc\web.config line 25) ---> System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString) at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) --- End of inner exception stack trace --- at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) at System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) at System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) at System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors) at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound) at System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetCompiledType(String virtualPath) at ToSic.SexyContent.Engines.RazorEngine.CreateWebPageInstance() in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\RazorEngine.cs:line 109 at ToSic.SexyContent.Engines.RazorEngine.InitWebpage() in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\RazorEngine.cs:line 126 at ToSic.SexyContent.Engines.RazorEngine.Init() in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\RazorEngine.cs:line 30 --- End of inner exception stack trace --- at ToSic.SexyContent.Engines.RazorEngine.Init() in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\RazorEngine.cs:line 36 at ToSic.SexyContent.Engines.EngineBase.Init(Template template, App app, IInstanceInfo hostingModule, IDataSource dataSource, InstancePurposes instancePurposes, SxcInstance sxcInstance, Log parentLog) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\ToSic.Sxc\SexyContent\Engines\EngineBase.cs:line 59 at ToSic.SexyContent.SxcInstance.GetRenderingEngine(InstancePurposes renderingPurpose) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\ToSic.Sxc\SexyContent\SxcInstance_Render.cs:line 119 at ToSic.SexyContent.SxcInstance.Render() in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\ToSic.Sxc\SexyContent\SxcInstance_Render.cs:line 58

iJungleboy commented 5 years ago

Closed because of inactivity, will reopen if it surfaces again.

trouble2 commented 4 years ago

Just found another:

Check your web.config for empty xmlns tags like: <assemblyBinding xmlns="">

And remove them, like: <assemblyBinding>

That worked for me...

iJungleboy commented 4 years ago

awesome @trouble2 thx!

VashJuan commented 4 years ago

Woot!

Removing the one blank xmlns="" did not help me but adding in the following before all the other entries to my root web.config file did the trick. THANKS @perezandres!

`

`
efficiondave commented 4 years ago

I had the same issue. Adding the System.Web.Helpers dependent assembly fixed it for me. None of the other fixes mentioned worked.