title: Why .NET RESTful API can load DLLs on development machine but not on other (AWS EC2) machine?
body: <p>I am building a .NET (4.6.1) RESTful API (on winx64 OS) and its working fine on my development, but when I copy the service binary on other (win64 OS) machine it fails on the lines where I try to make use of these binaries to which I referenced (i.e. to crate a class instance/object). To be precise I am referencing IBM.Data.DB2.iSeries.dll in my project. This binary is part of IBM Client access software and this software is installed (hence the binary is also on exact same path on both machines).</p>
  <p>I have tried compiling the code on the machine the code is failing, I am using MSBuild.exe to get that done, but of no use, facing same issue.</p>
  <p>Following is the stack-trace of the error I am getting.</p>
  <p><em><code>{&quot;message&quot;:&quot;An error has occurred.&quot;,&quot;exceptionMessage&quot;:&quot;The type initializer for 'IBM.Data.DB2.iSeries.iDB2Constants' threw an exception.&quot;,&quot;exceptionType&quot;:&quot;System.TypeInitializationException&quot;,&quot;stackTrace&quot;:&quot;   at IBM.Data.DB2.iSeries.iDB2Connection.InitializeDefaultProperties()\r\n   at IBM.Data.DB2.iSeries.iDB2Connection..ctor(String connectionString)\r\n   at tractelsyncrestapi.Helpers.AS400Helper.ExecuteProcedureNoParam(String procName, String libraryName) in C:\\Sandbox\\tractelsyncrestapi\\tractelsyncrestapi\\Helpers\\AS400Helper.cs:line 186\r\n   at tractelsyncrestapi.Controllers.InventoryController.GetInventoryDataFromAS400(Boolean onlyNewData) in C:\\Sandbox\\tractelsyncrestapi\\tractelsyncrestapi\\Controllers\\InventoryController.cs:line 59\r\n   at tractelsyncrestapi.Controllers.InventoryController.Get() in C:\\Sandbox\\tractelsyncrestapi\\tractelsyncrestapi\\Controllers\\InventoryController.cs:line 98\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.&lt;&gt;c__DisplayClass6_2.&lt;GetExecutor&gt;b__2(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.&lt;InvokeActionAsyncCore&gt;d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.&lt;ExecuteAsync&gt;d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.&lt;SendAsync&gt;d__15.MoveNext()&quot;,&quot;innerException&quot;:{&quot;message&quot;:&quot;An error has occurred.&quot;,&quot;exceptionMessage&quot;:&quot;The provider cannot run in 64-bit mode.&quot;,&quot;exceptionType&quot;:&quot;System.NotSupportedException&quot;,&quot;stackTrace&quot;:&quot;   at IBM.Data.DB2.iSeries.iDB2Constants..cctor()&quot;}}</code></em></p>