Total Pageviews

Search This Blog

Showing posts with label Biztalk 2013. Show all posts
Showing posts with label Biztalk 2013. Show all posts

Wednesday, June 24, 2015

Troubleshooting IIS WCF Service Error Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format

Greetings!

In one of my Ax/Biztalk/Oracle integration projects, I had to write a web service to retrieve data from Oracle and as part of that development, I was using the Enterprise Library from Microsoft, On my development box, the build was good and my VS project compiles successfully without any issues.

However, while hosting the webservice on IIS 8.0 (Windows Server 2012)  and trying to browse from the internet explorer, I got this error below:

Error:

Server Error in '/' Application.


Could not load file or assembly 'Framework.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format.
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.BadImageFormatException: Could not load file or assembly 'Framework.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Framework.Data' could not be loaded.

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].

Stack Trace:

[BadImageFormatException: Could not load file or assembly 'Framework.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +210
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +242
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +17
   System.Reflection.Assembly.Load(String assemblyString) +35
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +122

[ConfigurationErrorsException: Could not load file or assembly 'Framework.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +12480704
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +499
   System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +131
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +331
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +148
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +172
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151

[HttpException (0x80004005): Could not load file or assembly 'Framework.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12601936
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159


Solution:

After some troubleshooting, found the fix is to set Enable 32-bit Application = True on the App Pool which is used by the webservice. This solved the problem.









Thursday, October 2, 2014

Troubleshoot Dynamics AX 2012 AIF Error File cannot be opened because the submitting user could not be determined

Dear Friends,

Hope you are having a great start to the weekday. I had a great relaxing weekend, No AX for couple of days :).. It's good to catch a break in between as I had been working and testing several integration scenarios using Dynamics AX 2012, CRM, Biztalk and Oracle. There's plenty of posts to come out so make sure to watch out this blog.

Few days ago, while troubleshooting Biztalk Integration with AX 2012 R3, I faced this error

Error:

File C:\AIFIn\{117634FA-CD67-4F58-B37E-1D92BFFAE050}.xml cannot be read because the submitting user could not be determined. The default owner for files created by members of the Administrators group must be set to a specific windows user or a default file owner should be enabled and specified in port configuration.

Solution:

Doing some Google search around this error, got me to this link from our fellow AX Blogger http://pyaarey.wordpress.com/2012/02/29/the-file-system-adapter-is-unable-to-read-the-file-fbtsdemo1aifin1-xml-error/


It helped me to solve the issue so, I'm just putting a screenshot around the post so that people can understand how to troubleshoot.

a. Navigate to System Administration => Setup => Services and Application Integration Framework => Inbound Ports.

b. Click to the Port that you would have created. Click ‘Deactivate’ if it is already activated.

c. For the inbound Xml location  click ‘Configure’ button. A pop-up with appear with 2 options and check boxes. You need to check the first option ‘Use default owner for Administrators group:’ and then select user from the drop down list. I am assuming that this user is already added as a System Administrator users list in Dynamics AX 2012. Click Ok to save the changes.