Total Pageviews

Search This Blog

Showing posts with label Dynamics AX 2012 R3. Show all posts
Showing posts with label Dynamics AX 2012 R3. Show all posts

Tuesday, December 1, 2015

Announcing support for Team Foundation Server 2015 with AX 2012 R2 and R3

Greetings All,

Here's an announcement from Microsoft re. TFS 2015 support with AX 2012

http://blogs.technet.com/b/dynamicsaxse/archive/2015/11/21/announcing-support-for-team-foundation-server-2015-with-ax-2012-r2-and-r3.aspx

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.









Saturday, June 13, 2015

Book Review - Dynamics AX 2012 R3 Development Cookbook

Dear Friends,

Hope you are having a good time.

Thanks to Velinda from Packt Publishing for providing me with yet another copy of cookbook for review.

Introduction

Microsoft Dynamics AX 2012 R3 Development Cookbook is a handy and a must have book for any developer who is working on AX 2012 R3. It provides with practical scenarios which a developer comes across in his/her day to day work.






About the Author

Mindaugas Pociusis currently a freelance Dynamics AX technical and functional consultant and trainer at DynamicsLab Limited (www.dynamicslab.com). 

He is a Certified Microsoft Trainer for Dynamics AX and has delivered numerous Dynamics AX trainings.Mindaugas has participated in over 20 Dynamics AX implementations. He has held a wide range of development, consulting, and lead roles while always maintaining the significant role of a business application developer.
In December 2009, he released his first book, Microsoft Dynamics AX 2009 Development Cookbook, and then in May 2012, its second edition, Microsoft Dynamics AX 2012 Development Cookbook, both of which are published by Packt Publishing.

In order to obtain a copy of the book, please visit this link


Book Chapters

This book covers the following chapters

Chapter 1 - Processing Data

This chapter covers various scenarios like creating number sequence, merging records, renaming primary key, Executing Direct SQL Statement, Import/Export data from XML file, Building query objects.

Chapter 2 - Working with Forms

This chapter covers topics like using a tree control, Building a checklist form, Creating dialogs using the Runbase framework, Building a dynamic form through code etc

Chapter 3 - Working with Data in Forms

This chapter explains how to create custom filter control, preload images, create a wizard, processing multiple records, Adding image to records.

Chapter 4 - Building Lookups

This chapter is all about lookups - creating a lookup dynamically, using a form to build a lookup, Building a tree lookup and so on.

Chapter 5 - Processing Business Tasks

This chapter walks through various application scenarios like using segmented journal entry control, creating a general journal, posting a general journal, Processing Project Journal, Creating and Posting a Ledger Voucher, Creating and Posting Purchase Order, Creating and Posting Sales Order.

Chapter 6 - Integration with Microsoft Office

This chapter briefs on the various integration scenarios with Microsoft Office Products

Chapter 7 - Using Services

This chapter is all about creating and extending services (AIF and custom services) in Dynamics AX

Chapter 8 - Improving Development Efficiency

This chapter is about building extensions for Code Editor and Personalization forms

Chapter 9 - Improving Dynamics AX Performance

This chapter demonstrates the tools used to troubleshoot AX Performance like Dynamics AX Trace Parser, Calculating code execution time, Using SQL Server Database Engine Tuning Advisor.

Overall, a good book with plenty of code snippets which can be used on a daily basis.

Thursday, March 5, 2015

How to consume ABN (Australian Business Number) or ACN web services from AX 2012 R3

Dear Friends,

Greetings!

Have been super busy with so much to do in so less time!

However, I wanted to take some time and post about my recent experience on how I went integrating ABN Web Service with AX 2012 R3 CU8.

In Australia, we have a concept of ABN and ACN numbers for business registration. ABN is for Australian Business Number and ACN is for Australian Company Number. These registrations are governed by ABR as they are the authority to issue the registration numbers and they maintain this database.

Now, let's get started.

First thing, you would need to go to the ABR site and register to use their webservices.
http://abr.business.gov.au/Webservices.aspx

Once the application is processed which happens within an hour they will e-mail you an authentication GUID (Globally Unique Identifier) which is required to access the ABN Lookup web services. Also with the email, they will send you a pdf which shows you how to access the webservice through various clients like C#, Java, VB6, MS Access etc

Next step, is to open Visual Studio, create a Windows Class Library project and reference the web service. Note, since this is classic web service (.asmx based), so just consume it via the web references node as shown

Web Reference - http://abr.business.gov.au/AbrXmlSearch/AbrXmlSearch.asmx?wsdl













Once this is done, next step is to deploy the Project to AOT (as shown below).




Now, back in AX you should be able to see your deployed project






























Now, let's write some code.. Here is a simple job which I have used to pass a valid ACN number and it returns me the organisation name.

Output:


Tuesday, January 27, 2015

Tips AXBuild.exe - A quicker way to compile your AX application

Greetings All!

Lately, I'm using AxBuild.exe to do my compilation and it's really quick. Have now used it several number of times and really impressed with the faster response time compared to traditional way of compiling your code.

Some useful links for AXBuild

http://msdn.microsoft.com/en-us/library/dn528954.aspx

http://blogs.msdn.com/b/axtools/archive/2013/11/04/parallel-x-compilation-for-microsoft-dynamics-ax2012-r2-in-cumulative-update-7.aspx


In my scenario, I did a build  with 12 worker threads and it took me less than 13 minutes to compile the application




Thursday, January 15, 2015

Dynamics AX 2012 R3 CU8 Installation Steps



Dear Friends,

Greetings and Wish you all Happy New Year! Hope you had a great start!

In this blog post, I will be sharing my experience on upgrading CU8 to my existing AX 2012 R3 environments. I had to upgrade on 6 environments and let me tell you the installation experience of CU8 is quite different from my previous experiences with AX versions and there’s a set of things you would need to complete.

You can read about the CU8 Release, what’s included in the update, Help content over here - http://blogs.msdn.com/b/axsupport/archive/2014/11/19/cumulative-update-8-for-microsoft-dynamics-ax-2012-r3-now-available.aspx

Based on the installation guide and other technet articles I have prepared my own steps which helped me to install in multiple environments, Thought to share with you below:

1.        Backup AX2012 R3 Model and Prod database
2.        For a test upgrade, you can Restore to a copy of both model and prod database
3.        After restore, Check permissions to see if the aos service account is mapped rightly to the restored database
4.        Install new aos pointing to the restored database
5.        Change system service accounts in AX
6.        Change Server configuration , Batch Server so that it points to the new AOS
7.        Refresh WCF Config from client (Generate a new one if prompted to)
8.        Export the newly configured axc file
9.        Go to Lifecycle Services -> Create a new project for the environment you are planning to upgrade CU8
Tip - Make sure you enable Active scripting in your IE Settings in-order to work with the new Lifecycle Services Dashboard
a.        Open Internet Explorer, click the "Tool" button in the menu bar, select the "Internet Options" button and then select the "Security" tab
b.         Select the "Internet" area, select "Custom Level" and go to the "Security Settings - Internet Zone" box.
c.        Click the checkbox to enable "Active Scripting" under the Scripting section and then click the OK button to apply the settings.
d.        Restart your browser when finished to apply the settings and enable JavaScript

10.     Download the installer package from System Diagnostic  menu in LCS
11.     Run the installer on AOS box
12.     Create a new certificate via the wizard












13.     Upload the certificate in LCS
14.     I used the aos service account below here
15.    












16.     Once installed, Run the LCS Diagnostic tool to discover the environment which we need to upgrade
17.      Run Discover environment wizard to discover the environments
19.     Upload the environment to LCS
20.     Now go to System diagnostic in LCS -> Click on update button




18. 














21.     Use option 1 that is update installer for Microsoft Dynamics AX 2012 R3 if you already have AX 2012 R3 installed
22.     Verify that you have appropriate permissions. To run the Update installer, you must have administrator rights on the local computer and System Administrator rights in Microsoft Dynamics AX. 
23.     To install application hotfixes, you must have the following additional rights in Microsoft SQL Server:
-          You are a member of the Securityadmin server role on the SQL Server instance.
-          You are assigned to the db_owner role in the model database.
24.     Run AXupdate.exe


















Tip – Suggest you to save the package (axupdate.exe) and hence need not go through the download option again and again.



















25.     Run Axupdate.exe and update the binary and application fixes
26.     While doing the binary updates, if you encounter the below CLR error for SQL Server 2012, make sure you download it from the below website

               













27.     Also you would need to install Report Viewer Control as it’s one of the pre-requisite for Binary Updates
28.     Run Intitialize-AXModelStore \
PS C:\Windows\system32> Initialize-AXModelStore -Database <DatabaseName> -Se
rver <ServerName>
Model store schema successfully created.


29.     Restart AOS
30.     Run the software update checklist from AX
31.     Do Full compile via axbuild.exe (Will save you some time!)
32.     Make sure to check the AX Log and fix all  compilation errors before you head on to the next step
33.     Do CIL Compile
34.     Resolve the compilation errors before running data upgrade
35.     Run through data upgrade checklist
36.     Run the axupdate.exe on the report server as well to update report components



Appendix 


Axbuild.exe (syntax below)

C:\Program Files\Microsoft Dynamics AX\60\Server\AX2012PROD\bin>axbuild.exe xppcompileall /s=02 /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin"



If you are getting CIL Compile Errors, that means go and check the normal Compile App log, and fix all the errors which you find there and then do a CIL Compile again to make it success



SSRS Upgrade

To upgrade SSRS components of AX, Run AXupdate.exe from the SSRS instance box

Client Upgrade

To upgrade Client components and Office Add-in, run axupdate.exe from where the client is installed.

For me, the office-add ins were not getting successfully installed at the first time and hence my client installation was not successful, and in order to fix it, I had to uninstall the previous R3 client, reboot the system, make sure the client/bin folder is not there, reinstall R3 client and then run axupdate.exe – this time it was successful

AIF Upgrade

If AIF and IIS are on different boxes, then make sure to run axupdate.exe from that box

Install Visual Studio 2013 Developer tools

In order to install VS 2013, you would need to first uninstall VS 2010 developer components by running AX2012 R3 Setup/installer and then reboot and install VS 2013 Developer tools. (Before installing VS 2013 Developer tools, you need to have full VS 2013 Installed – In my case, I have premium version of VS 2013)


To uninstall VS 2010 Developer tools Run Dynamics AX 2012 R3 Installer > remove component