Try our conversational search powered by Generative AI!

Get error Initialize action failed for Initialize on class EPiServer.Forms.EditView.InitializationModule after successful NuGet package install

Vote:
 

I get this erroir when trying to run my site after installing Forms. Running target framework net8.0.

An error occurred while starting the application.
ArgumentException: Unable to find a module by assembly 'EPiServer.Forms, Version=5.7.2.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7' (Parameter 'moduleAssembly')
EPiServer.Shell.Paths.ToResource(Assembly moduleAssembly, string moduleRelativeResourcePath)

InitializationException: Initialize action failed for Initialize on class EPiServer.Forms.EditView.InitializationModule, EPiServer.Forms.UI, Version=5.7.2.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7
EPiServer.Framework.Initialization.InitializationEngine.InitializeModules()

I've added the following section into appsetting.json. Not sure what everything needs to be set at. Comment out some of it for now. These are the default setting from the EPiServer help page.

"Forms": {
  "FormsConfig": {
    "VisitorSubmitTimeout": 1,
    "DisableFormCookies": false,
    "DataExportBlobProviderName": "DefaultDataExportBlobProvider",
    "SerializingObjectUsingNameValueFormat": true,
    "SendMessageInHTMLFormat": true,
    "MinimumAccessRightLevelToReadFormData": "Edit",
    "CoreController": "/EPiServer.Forms/DataSubmit",
    "DefaultUploadExtensionBlackList": "asp,aspx,asa,ashx,asmx,bat,chm,class,cmd,com,config,dll,exe,hta,htr,htw,jse,json,lnk,mda,mdb,msc,msh,pif,printer,ps1,ps2,reg,rem,scf,scr,sct,shtm,shtml,soap,stm,svc,url,vb,vbe,vbs,vsix,ws,wsc,wsf,wsh,xamlx,htm,html,js,jar",
    "FormElementViewsFolder": "~/Views/Shared/ElementBlocks",
    "WorkInNonJSMode": false,
    "InjectFormOwnStylesheet": true,
    "InjectFormOwnJQuery": true,
    "RenderingFormUsingDivElement": false,
    //"PreconfiguredFeeds": [
    //  {
    //    "Id": "Your Id",
    //    "Description": "Your Description",
    //    "Url": "Your Url",
    //    "KeyXPath": "Your KeyXPath",
    //    "ValueXPath": "Your ValueXPath",
    //    "CacheTimeout": 90
    //  }
    ]
  },
  "FormsPermanentStorageProvider": {
    "DefaultProvider": "DdsPermanentStorage",
    "Providers": {
      "DdsPermanentStorage": {
        "Type": "EPiServer.Forms.Core.Data.DdsPermanentStorage, EPiServer.Forms.Core",
        "Parametters": {}
      },
      //"DdsEncryptedPermanentStorage": {
      //  "Type": "EPiServer.Forms.Core.Data.Internal.DdsEncryptedPermanentStorage, EPiServer.Forms.Core",
      //  "Parameters": {
      //    "CryptoEngineType": "EPiServer.Forms.Crypto.AzureKeyVault.Internal.AzureKeyVaultCryptoEngine, EPiServer.Forms.Crypto.AzureKeyVault",
      //    "KeyIdentifier": "Your KeyIdentifier",
      //    "TenantId": "Your TenantId",
      //    "ClientId": "Your ClientId",
      //    "ClientSecret": "Your ClientSecret"
      //  }
      }
    }
  }

#315361
Jan 09, 2024 22:29
Vote:
 

This has been fixed. We had to add this code in one of our all StatrtUp classes so they would work when ran by themselves. It would have been nice on the Forms setup page if this is mentioned when using multiple projects within a solution.

if (webHostEnvironment.IsDevelopment())
{
    var moduleName = typeof(EPiServer.Forms.Constants).Assembly.GetName().Name;

    services.Configure<CompositeFileProviderOptions>(options =>
    {
        options.BasePathFileProviders.Add(new MappingPhysicalFileProvider(
            $"/EPiServer/{moduleName}",
            string.Empty,
            webHostEnvironment.ContentRootPath + "\\bin\\debug\\net8.0\\modules\\_protected\\EPiServer.Forms"));
    });

    services.Configure<ProtectedModuleOptions>(options =>
    {
        options.Items.Add(new ModuleDetails { Name = moduleName });
    });
}
#316764
Edited, Feb 06, 2024 20:13
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.