Category Archives: Microsoft Dynamics AX

Insufficient memory to run script

Today I met a boundary when creeating a routine that produces a pricelist in AX 4.0 for a webshop. When creating the required xml I was receiving the error:

Error executing code: Insufficient memory to run script.

It turns out that AX4.0 per default has a 4mb buffersize. And as the resulting xml would contain about 16 mb of data I kept getting the exception. I found good help to increase the buffersize in this post from Martin Dráb.

How to export configuration settings for AIF inbound/outbound ports

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…:-)

Unable to render content due to an error. Please contact your system administrator.

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.

Assembly containing type is not referenced

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:

  1. create a class with a new method and instantiate your dll in that method.
  2. Set the class to run on client
  3. Create a job and run the method.
  4. Switch the class properties to run on server and perform the same test again.
  5. If no errors occur You are good to go…

The HTTP request is unauthorized with client authentication scheme ‘Basic’. The authentication header received from the server was ‘Basic realm="some_name"’.

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…

Troubleshooting Enterprise Portal error messages

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:

AIF – getting offline WSDL files

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…

How to implement basic authentication in Dynamics AX2012 webservice

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.

AX2012 CIL debugging

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:

  1. Install VS2010/VS2012/VS2013 depending on your ax version on the AOS
  2. Run the Microsoft Dynamics AX Setup and choose to install the Visual Studio Tools.
  3. 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.
  4. Configure the AOS for debugging. Go to the Dynamics AX Server configuration tool and be sure that the following checkmarks are set
  5. 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.
  6. 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)
  7. 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.
  8. Go back into AX and do the things you need in order to hit the breaktpoint.
  9. 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.