Posted by Torben M. Philippsen on July 14, 2016
A very tedious task of mine has often been to deploy AIF services accross environments. I am used to do this the old school way = manually.
Today I had something that might be compared to as an epiphany – I stumbled upon this great technet artichle descripting how to export the configuration settings using the data import/export framework. Tried it out for the first time today and it’s working just great. The only downside so far, is that I haven’t been aware of this feature before…:-)
Posted in AIF, Microsoft Dynamics AX | Tagged: AIF, configuration settings, export, inbound port, outbound port | Leave a Comment »
Posted by Torben M. Philippsen on May 23, 2016
Recently I experienced a strange error in an usercontrol. The error would cause the classic “Unable to render content due to an error. Please contact your system administrator.” message on EP and in the eventviewer I saw this:
The strange thjing turned out to be that the code for the usercontrol was an exact match with the one from a reference environment where everything worked just fine.
Trying to narrow things down I ended up finding that it was the AllowPaging property on the grid that was set to false that caused the error. Setting this property to true, would make the control work just fine. However my customer didn’t want paging – and it woked just fine in the reference environment. Giving this thought I concluded that the error was related to data. In my environment the dataset would return 55 records and in the reference environment I would have just 12 records. I started to play around with the PageSize property of the grid and found the the magic limit was 45 records. A limit of 44 in the PageSize property would make the control work just fine, whereas a limit of 45 would make the control crash with the above eventlog entries to follow.
I don’t think that the error is related to 45 records but more likely the size of the entire dataset. In my case the dataset contains information about expences and in that context some image/binary bitmap data. I therefore expect the data to be quite big.
If you begin to experience strange errors like the ones above – maybe it would be a good idea to look into the size of data.
Posted in Enterprise Portal Development, Microsoft Dynamics AX | Tagged: ax2009, EP | Leave a Comment »
Posted by Torben M. Philippsen on April 29, 2016
When developing VS studio components in AX2012 You might experience the following error trying to run the code:
When You build your vs project You will have to decide whether to publish to either client or server or maybe even both. This is where You need to keep in mind, that the server is quite certain to run as a 64 bit application where the client runs in 32 bit mode. So when building your dll for either server or client, You need specifically target the right cpu architecture. If You are deploying to both client and server You need to build using the “AnyCPU” option.
Using the AnyCPU option will cause a warning when compilling – just ignore it…
If You need to test your component on both server and client an easy way could be to:
- create a class with a new method and instantiate your dll in that method.
- Set the class to run on client
- Create a job and run the method.
- Switch the class properties to run on server and perform the same test again.
- If no errors occur You are good to go…
Posted in Microsoft Dynamics AX | Tagged: cpu architecture, deploy, deployment, dll, Dynamics ax 2012, vs projects | Comments Off on Assembly containing type xxx.xxx is not referenced
Posted by Torben M. Philippsen on April 20, 2016
Today I spent quite some time struggling how to figure out was wrong with my client implementation of an AIF webservice. I kept getting the error “The HTTP request is unauthorized with client authentication scheme ‘Basic’. The authentication header received from the server was ‘Basic realm="some_domain_name"’.”
It was the realm part I didn’t understand. I had configured the service in AX to use basic authentication. From a reference environment, I knew the configuration had been working.
It turned out that my focus on the realm part was wrong because the reason to the error was invalid login credentials. How invalid login credentials can trigger the above error message is not for me to say. I would have expected a message like “Failed to log in to Microsoft Dynamics AX” instead. Just thought I would share my experience…
Posted in AIF, Microsoft Dynamics AX | Tagged: realm | Comments Off on The HTTP request is unauthorized with client authentication scheme ‘Basic’. The authentication header received from the server was ‘Basic realm="some_name"’.
Posted by Torben M. Philippsen on April 4, 2016
If you have been working with enterprise portal development, you will probably have gone through the same levels of frustration as I because error messages are not good in adding usable information into these messages. Over time I have collected some sites with suggestions on how to troubleshoot these more or less cryptric messages.
Error: Enterprise Portal Web Parts show "Unable to render content" error
Error: Unable to render content due to an error. Please contact your system administrator.
Generel troubleshooting: https://msdn.microsoft.com/en-us/library/cc554278.aspx
Posted in Enterprise Portal Development, Microsoft Dynamics AX | Tagged: EP, errors, troubleshooting, Unable to render content, Unable to render content due to an error. Please contact your system administrator | Comments Off on Troubleshooting Enterprise Portal error messages
Posted by Torben M. Philippsen on March 2, 2016
Quite often when dealing with AIF service I am asked to send a WSDL for a service to a 3rd party partner. Typically the partner dowsn’t have access to the service in that phase of the project. This means that I would have to send physical wsdl files (and not just an URL). In my experience the “singleWSDL” feature introduced with .net framework 4.5 doesn’t work for AIF services. In these cases AIF can be quite thedius to work with because the wsdl references other wsdl files as well as xsd’s. So in order to being able to send an offline wsdl file to a partner, you have to do a little bit of manual work. Ofcourse there are many ways to achieve the same, but here’s a guide of way, that I have found quite easy to work with.
- Make sure the service has been published.
- Open visual studio and create a console application. Add a new service reference pointing to the your service. Visuial studio now creates proxy classes as well as downloads referenced wsdl’s and xsd’s. You should see something similar to this in your project:
Please note the 3 WSDL files and 6 XSD files.
- Locate the physical location of the files (right click in VS and look at the file properties)
- Copy all of the WSDL and XSD to a new folder of your choice (outside the project). This folder now contains the files that we want to send to our partner. But before sending them, we need to do some minor modifications.
- Open the RoutingService.wsdl in your editor (VS will do just fine). Find and edit all import statements:
You will se that the Locations attribute references a http address. Edit the location to point to the local file residing in the current folder.
You will want to do the same for the service location:
Make sure to point to the local file instead of the url.
- Do the same for the other 2 WSDL files. It’s quickly done.
- When finished You can test your work by going back into visual studio. Just simulate adding a new service reference pointing to the local wsdl files instead. Remember it is the RoutingService.wsdl that is Your point of entry. If VS doesn’t complain You are now finished.
- Finally zip the folder and sent it to the partner.
If You know of a better/easier way please post a comment…
Posted in AIF, Microsoft Dynamics AX | Tagged: AIF, offline wsdl | Comments Off on AIF – getting offline WSDL files
Posted by Torben M. Philippsen on February 26, 2016
Recently I had to configure an inbound port for basic authentication. Furthermore I had to produce a guide in order to being able to set it up in the same way in other environments.
Lucky for me, I found this great guide, that I would like to share. You can also use it as a template for configuring other types of authentication.
Posted in AIF, Microsoft Dynamics AX | Tagged: AIF, basic authentication, configure authentication, WCF | Comments Off on How to implement basic authentication in Dynamics AX2012 webservice
Posted by Torben M. Philippsen on February 22, 2016
AS You know there are a lot of guides out there on how to debug CIL. However when problems occur I find that quite a lot are missing some important things. So here’s my shot at a guide on how to debug CIL code.
In AX2012 some code is run in CIL (Common Intermediate Language). In general it means that our x++ code is compiled into .net. For instance batchjobs and other serverside code is run in CIL (unless configured otherwise).
If You want to read more regarding the background please visit this link – X++ compiled to .NET CIL.
Sometimes a mismatch can occur between the x++ code and the CIL code, and in these cases, it is nice being able to debug. I will try to list some important things that You may want to concider/check.
- You will have to use at least VS 2010
- I would recommend doing a local debug session – meaning your visual studio should be installed directly on the AOS. You can setup remote debugging but that just opens for a whole lot of new problems. Keep it simple – keep it on the AOS.
- If possible You will prefer to have exclusive access – meaning no other users should be logged on. When debugging serverside code, you will hit every breakpoint triggered accross users. This means if you are debugging in an area where a lot of users are working, you will have to struggle with breakpoints being hit in a way you can’t possible imagine.
In order to configure your environment for CIL debugging You need to do this:
- Install VS2010/VS2012/VS2013 depending on your ax version on the AOS
- Run the Microsoft Dynamics AX Setup and choose to install the Visual Studio Tools.
- Generate/locate the sources
When CIL compillation is performed it outputs .xpp files in C:\Program Files\Microsoft Dynamics AX\60\Server\<AOS_INSTANCE_FOLDER>\bin\XppIL and source files for Visual studio here C:\Program Files\Microsoft Dynamics AX\60\Server\<AOS_INSTANCE_FOLDER>\bin\XppIL\Source
On some occations I have experienced the the source folder does not exist. In these cases stop the AOS service, delete all contents of the XppIl folder, restart the AOS (Maybe You need to perform a full CIL before). If you are not doing local debugging, You will need to setup a share for this folder.
- Configure the AOS for debugging. Go to the Dynamics AX Server configuration tool and be sure that the following checkmarks are set
- Launch visual studio in admin mode. Be aware that when VS connects to AX it uses the configuration from the client configuration tool. Make sure that you have set up the configuration you need – connecting to the correct layer etc (not important if you are just debugging).
Launch the Dynamics AX Application Explorer to browse the AOT and set the breakpoints of your choice. When You double clikc a method a new solution is automatically created in solution explorer.
- Right click the newly created solution and select “properties”.
Select “debug source files”.
Add the path for the source files (local path or remote share)
- Now You are ready to attach Visual Studio to the AX32Serv process. Click the “Debug” menu item and select “attach to process”. Locate the AX32Serv process and attach to it. If VS is not in admin mode VS will now ask you to restart in elevated mode.
- Go back into AX and do the things you need in order to hit the breaktpoint.
- If You are not hitting any breakpoint you need to check, that you are set up to run code in CIL. Inside AX open a development environment. Go to Tools –> Options –> Development
Make sure that the checkbox “Execute business operations in CIL” is checked.
Posted in Microsoft Dynamics AX | Tagged: CIL, debugging | Comments Off on AX2012 CIL debugging
Posted by Torben M. Philippsen on January 25, 2016
Recently I was working on a case where some issues occured when trying to synhronize data between MS dynamics ax 2012 and MS CRM.
In MS CRM the following maps have been set up for synchronization in two integrations.
Each integration uses its own AX user for connection.
From the CRM point of view, the synchronization seems to succeed. However going through the exception log in AX it seems that quite a few deadlocks have occurred, please see screendump below:
And here’s a screendump from the “general” tab showing the error message – “Cannot select a record in Change Tracking Version (AifSqlCtVersion). Change Tracking Version: 0.
Deadlock, where one or more users have simultaneously locked the whole table or part of it.”:
The deadlocks seems to have disappeared by themselves.
From this blog post this issue seems to be a known issue – https://community.dynamics.com/ax/f/33/t/160640 – however the ax database had not recently been updated.
The cause seems to be the SQL optimiser doing a clustered index scan (RecId) in the query below, resulting in blocking:
SELECT T1.CTVERSION,T1.CREATEDDATETIME,T1.RECVERSION,T1.RECID FROM AIFSQLCTVERSION T1 WITH ( UPDLOCK) WHERE (CTVERSION<@P1)
- Login to Dynamics AX –> Open a Development workspace, and navigate to AOT –> Dictionary -> tables,
Find the table AIFSQLCTVERSION , and create a new non-unique index for CTVERSION field
- Login to SQL server Management studio, and create a new plan guide for the query adding index hint
EXEC sp_create_plan_guide @name = N'[PlanGuide-AIFSQLCTVERSION]’, @stmt = N’SELECT T1.CTVERSION,T1.CREATEDDATETIME,T1.RECVERSION,T1.RECID FROM AIFSQLCTVERSION T1 WITH ( UPDLOCK) WHERE (CTVERSION<@P1)’, @type = N’SQL’, @module_or_batch = N’SELECT T1.CTVERSION,T1.CREATEDDATETIME,T1.RECVERSION,T1.RECID FROM AIFSQLCTVERSION T1 WITH ( UPDLOCK) WHERE (CTVERSION<@P1)’, @params = N’@P1 bigint’, @hints = N’OPTION (TABLE HINT (T1, INDEX( I_100021KOO_CTVERSIONIDX), UPDLOCK))’
GO(replace the index name I_100021KOO_CTVERSIONIDX with the actual name of the newly created index)
Posted in AIF, Microsoft Dynamics AX | Tagged: Cannot select a record in Change Tracking Version (AifSqlCtVersion), CRM synchronization causing deadlocks in AX | Comments Off on Deadlocks show up in AIF exception log when CRM synchronizes multiple companies.
Posted by Torben M. Philippsen on January 25, 2016
Recently I was presented with a very interesting problem that occured when Microsoft CRM was synchronizing with Microsoft Dynamics AX 2012 using the DynamicsConnector for MS Dynamics AX. The installation guide can be found here.
In basics it was a standard setup in both ends. When syncing only one company everything would work just fine, but when syncing two or more companies the online users would be filled with active connections that wouldn’t close by themselves. In the end this would lead to the AOS not accepting new clients or even a crash due to lack of RAM.
The strange thing was that everything was setup according to the guidelines and was working fine in a reference environment. A MS support request was created and I will try to summarize all of our findings and the solution that fixed the problem.
The problem in short:
- When running the synch of 2 or more companies simultaneously, the client session on AX continues to increase till the crash of AOS.
- Running synch of 1 company only (in other words 1 integration) the client sessions do not increase; looks like they are recycled.
- The problem occurs in all maps and seems to be a general problem in our scenario.
- The synchronization for all companies is running on the same AX account.
- The verified solution from MS was to create separate accounts for each synchronization.
Posted in AIF, Microsoft Dynamics AX | Tagged: connections not being closed, Microsoft CRM, multiple connections being created | Comments Off on Microsoft CRM: Synchronizing with multiple AX companies results in continuously opening new active AOS-connections