xBimTeam / XbimGeometry

XbimGeometry contains the CLR interop libraries and the c++ engine used to compute the 3D geometry of models.
https://xbimteam.github.io/
Other
260 stars 132 forks source link

Could not load file or assembly 'Xbim.Geometry.Engine64.DLL' or one of its dependencies. The specified module could not be found. #317

Closed simiii closed 3 years ago

simiii commented 3 years ago

We searched all issues regarding the topic 'Could not load file or assembly 'Xbim.Geometry.Engine64.DLL' or one of its dependencies. But we couldn't find a solution to our problem.

I am having setup a .NET 4.7.2 project in Visual Studio which works just fine on our development machines. We want to host the application on AWS elastic beanstalk. If we deploy our app to AWS Beanstalk (IIS 10.0 running on 64bit Windows Server 2019/2.6.3) the following error occurs:

Could not load file or assembly 'Xbim.Geometry.Engine64.DLL' or one of its dependencies. The specified module could not be found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Xbim.Geometry.Engine64.DLL' or one of its dependencies. The specified module could not be found.

Assemblies and versions affected:

The following software is installed on the AWS Elasticbeanstalk ec2-Instance:

Screenshot 2021-03-03 171336

The following DLLs are copied into the bin folder on the ec2-windows-instance (which looks quite good in our opinion as there is the Xbim.Geometry.Engine64.DLL

bin-folder-1png bin-folder-2

packages.json

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="ManagedEsent" version="1.9.4" targetFramework="net472" />
  <package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi.Client.de" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi.Core.de" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebApi.WebHost.de" version="5.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net472" />
  <package id="Microsoft.AspNetCore.Http.Abstractions" version="2.2.0" targetFramework="net472" />
  <package id="Microsoft.AspNetCore.Http.Features" version="5.0.2" targetFramework="net472" />
  <package id="Microsoft.AspNetCore.Mvc.Abstractions" version="2.2.0" targetFramework="net472" />
  <package id="Microsoft.AspNetCore.Routing.Abstractions" version="2.2.0" targetFramework="net472" />
  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.1" targetFramework="net472" />
  <package id="Microsoft.Extensions.Configuration" version="2.1.1" targetFramework="net472" />
  <package id="Microsoft.Extensions.Configuration.Abstractions" version="2.1.1" targetFramework="net472" />
  <package id="Microsoft.Extensions.Configuration.Binder" version="2.1.1" targetFramework="net472" />
  <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.1.1" targetFramework="net472" />
  <package id="Microsoft.Extensions.Logging" version="2.1.1" targetFramework="net472" />
  <package id="Microsoft.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net472" />
  <package id="Microsoft.Extensions.Options" version="2.1.1" targetFramework="net472" />
  <package id="Microsoft.Extensions.Primitives" version="5.0.0" targetFramework="net472" />
  <package id="Microsoft.Net.Http.Headers" version="2.2.0" targetFramework="net472" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net472" />
  <package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
  <package id="Newtonsoft.Json.Bson" version="1.0.1" targetFramework="net472" />
  <package id="NPOI" version="2.4.1" targetFramework="net472" />
  <package id="SharpZipLib" version="1.0.0" targetFramework="net472" />
  <package id="System.Buffers" version="4.5.1" targetFramework="net472" />
  <package id="System.Configuration.ConfigurationManager" version="4.5.0" targetFramework="net472" />
  <package id="System.IO.Pipelines" version="5.0.1" targetFramework="net472" />
  <package id="System.Memory" version="4.5.4" targetFramework="net472" />
  <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
  <package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net472" />
  <package id="System.Security.AccessControl" version="4.5.0" targetFramework="net472" />
  <package id="System.Security.Permissions" version="4.5.0" targetFramework="net472" />
  <package id="System.Security.Principal.Windows" version="4.5.0" targetFramework="net472" />
  <package id="System.Text.Encodings.Web" version="4.5.0" targetFramework="net472" />
  <package id="System.Threading.Tasks" version="4.3.0" targetFramework="net472" />
  <package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
  <package id="Xbim.Cobie" version="5.1.181-develop" targetFramework="net472" />
  <package id="Xbim.CobieExpress" version="5.1.147-develop" targetFramework="net472" />
  <package id="Xbim.COBieLite" version="5.1.181-develop" targetFramework="net472" />
  <package id="Xbim.COBieLiteUK" version="5.1.181-develop" targetFramework="net472" />
  <package id="Xbim.CobieLiteUK.Validation" version="5.1.181-develop" targetFramework="net472" />
  <package id="Xbim.Common" version="5.1.326-develop" targetFramework="net472" />
  <package id="Xbim.DPoW" version="5.1.181-develop" targetFramework="net472" />
  <package id="Xbim.Essentials" version="5.1.326-develop" targetFramework="net472" />
  <package id="Xbim.Exchange" version="5.1.181-develop" targetFramework="net472" />
  <package id="Xbim.Exchanger" version="5.1.181-develop" targetFramework="net472" />
  <package id="Xbim.Geometry" version="5.1.404-develop" targetFramework="net472" />
  <package id="Xbim.Geometry.Engine.Interop" version="5.1.404-develop" targetFramework="net472" />
  <package id="Xbim.Ifc" version="5.1.326-develop" targetFramework="net472" />
  <package id="Xbim.Ifc2x3" version="5.1.326-develop" targetFramework="net472" />
  <package id="Xbim.Ifc4" version="5.1.326-develop" targetFramework="net472" />
  <package id="Xbim.IO.CobieExpress" version="5.1.147-develop" targetFramework="net472" />
  <package id="Xbim.IO.Esent" version="5.1.326-develop" targetFramework="net472" />
  <package id="Xbim.IO.MemoryModel" version="5.1.326-develop" targetFramework="net472" />
  <package id="Xbim.IO.Table" version="5.1.147-develop" targetFramework="net472" />
  <package id="Xbim.ModelGeometry.Scene" version="5.1.404-develop" targetFramework="net472" />
  <package id="Xbim.PropertySets" version="4.0.1" targetFramework="net472" />
  <package id="Xbim.Tessellator" version="5.1.326-develop" targetFramework="net472" />
</packages>

logging form AWS elastic beanstalk

2021-03-03T14:40:30.000Z Warning 3:Web Event ASP.NET 4.0.30319.0 - Event code: 3008

Event message: A configuration error has occurred.

Event time: 3/3/2021 2:40:30 PM

Event time (UTC): 3/3/2021 2:40:30 PM

Event ID: fcae6d6587db43d98e409b6d5306dee1

Event sequence: 1

Event occurrence: 1

Event detail code: 0

Application information:

    Application domain: /LM/W3SVC/1/ROOT-2-132592560283044152

    Trust level: Full

    Application Virtual Path: /

    Application Path: C:\inetpub\wwwroot\

    Machine name: EC2AMAZ-SDP04VL

Process information:

    Process ID: 2216

    Process name: w3wp.exe

    Account name: IIS APPPOOL\DefaultAppPool

Exception information:

    Exception type: ConfigurationErrorsException

    Exception message: Could not load file or assembly 'Xbim.Geometry.Engine64.DLL' or one of its dependencies. The specified module could not be found.
   at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
   at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
   at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
   at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
   at System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
   at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded)
   at System.Web.Compilation.BuildManager.ExecutePreAppStart()
   at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

Could not load file or assembly 'Xbim.Geometry.Engine64.DLL' or one of its dependencies. The specified module could not be found.
   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)

We would like to deploy the application to AWS elastic beanstalk and would be very happy if you could have a quick look into this issue. Perhaps you see the error at once, like an incompatible redistribution library or missing DLLs or one of its dependencies.

We were able to deploy a .NET 4.7.1 App to AWS Elasticbeanstalk. So it might be a configuration problem, that comes into play with .NET 4.7.2.

martin1cerny commented 3 years ago

As you say, it is most likely an issue with missing VC++ redistribution library. Also, make sure you only deploy 'Xbim.Geometry.Engine64.DLL' OR 'Xbim.Geometry.Engine32.DLL'. IIS is trying to load everything in the folder and if you are running 32bit process, loading 64bit dll will fail.

andyward commented 3 years ago

Hi Simon,

It's always slightly tricky to track down these issues on servers under IIS etc. it could be one of several issues: https://github.com/xBimTeam/XbimGeometry/issues/312#issuecomment-778184952

I'd recommend hooking up logging to a file or other log source, which may help diagnose if it's a path/permission issues, or a VC dependency issue.

See https://github.com/xBimTeam/XbimGeometry/issues/195#issuecomment-514151888 for how to do that

simiii commented 3 years ago

Thank you guys for your help. I will try to implement the logging functionality.

simiii commented 3 years ago

I switched to Azure. No problems there. Can be closed.