Team Blog

The views expressed in this blog are those of the individual and do not necessarily represent those of Microsoft. This information is provided by way of general information only and should not be relied on without obtaining independent expert advice. These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.

One of the questions that has been raised frequently is how to install the Dynamics NAV demo database to a named instance of Microsoft SQL Server using the new installation program that was released with Dynamics NAV 2009. The short answer to this question is that this is not supported. However, there is a work around that in fact will allow you to do this.

Before going into how this can be accomplished there are a few things I need to highlight.

You cannot repeat this work around several times on a computer in order to install several demo databases. The work around involves running Windows Installer files (msi) and running such a file a second time will only repair or uninstall the product rather than installing a new instance of the product. You can create a demo database manually using some of the files on the installation media, but this is not within the scope of this blog entry.

You must not run the Microsoft Dynamics NAV 2009 installation program (setup.exe) on the computer after you have installed the demo database using this work around since this will uninstalled the demo database. This happens because the Microsoft Dynamics NAV 2009 installation program keeps an inventory of the Dynamics NAV products that have been installed to the computer and will uninstall those which are not in the inventory.

Now with this in place let's proceed with the work around.

The task at hand is to install the Dynamics NAV 2009 demo database to a named instance of Microsoft SQL Server 2005. The name of the instance is "CRONUSDEMO" and has already been installed to the computer "CRONUSSERVER" with the service account "NETWORK SERVICE". The Microsoft Dynamics NAV 2009 installation media is located in the DVD drive of your computer (D:\), but it will also work if you install from a local folder or a network drive. You must have administrative privileges on the computer.

Open a Command Prompt on the computer. You must open the command prompt as Administrator if the OS is Vista and you are running with User Account Control (UAC) turned on.

Run the following command: msiexec -I "D:\SQLDatabase\Microsoft_Dynamics_NAV_SQL_Database.msi" INSTANCENAME=CRONUSDEMO

Run the following command: msiexec -I "D:\SQLDatabase\Microsoft_Dynamics_NAV_SQL_DemoDatabase.msi" INSTANCENAME=CRONUSDEMO

The demo database is now installed and you should see two entries for this in the control panel.

To use the newly installed database with the Microsoft Dynamics NAV RoleTailored client you must manually set the Microsoft Dynamics NAV Server to connect to the SQL Server named instance. To do this you must edit the configuration file of the server.

Open the CustomSettings.config file using a text editor. You can find the file in the folder "\Program Files\ Microsoft Dynamics NAV\60\Service".

Locate the DatabaseServer key.

Change the value attribute to CRONUSSERVER\CRONUSDEMO

You do not have to change any settings on the RoleTailored client in order to connect to the database.

Tip: If SP1 is not installed for any of the 2005 version you will be asked to convert report when opening Visual Studio from Classic Client. Converting the report will not do any good, so SP1 is required.

Note: ZIndex hotfix is included in SP1 for Visual Studio 2008. ZIndex hotfix issue explained in the end of this blog post.

Note about Microsoft Visual Web Developer 2008 Express Edition:NOTE: ONLY IF YOU ARE USING DYNAMICS NAV 2009, SINCE THIS HAS NOW BEEN FIXED IN RELEASED SP1 Unfortunately this does not work out of the box with NAV 2009 RTM, since “Microsoft Report Viewer Add-on for Visual Web Developer 2008 Express Edition” was released after NAV 2009 RTM.

When using Visual Web Developer with Report Viewer Add-on, you will be asked to convert report when opening Visual Studio from Classic Client. Converting the report will not do any good.

There is a workaround for this:

1. Navigate to “C:\Program Files\Microsoft Dynamics NAV\60\Classic”

2. In this folder there is 2 folders called “ReportLayout2005” and “ReportLayout2008”

3. Copy all files from “ReportLayout2008” to “ReportLayout2005”

Doing this will of course kill support for “Microsoft Visual Studio 2005” and “Microsoft Visual Web Developer 2005 Express” on this specific client, but now Visual Web Developer 2008 works, and you no longer get the convert report message. We plan to have this issue resolved in SP1 for Microsoft Dynamics NAV 2009, so there is no need for this manual workaround.

Much like the setup of the RTC/NAV Server connection in NAV 2009. NAV 2009 Web Services needs to have a SPN added to properly authentic the users accessing it.

Consider the following scenario in Microsoft Dynamics NAV 2009. You have just completed the “Installing the Three Tiers on Three Computers” walkthrough. The NAV Role Tailored Client (RTC) is working. You have started the Microsoft Dynamics NAV Business Web Services service. When you attempt to view a Web Service URL in a web browser from a client machine you receive a login prompt. If you try to login, you are prompted three times before the process is stopped. An example of possible Web Service URLs is:

Note xxx is the server name of the Service Tier. This also assumes that you are using the default port (7047) and default service name (DynamicsNAV).

This problem occurs because a Service Principal Name (SPN) has not been added to the domain user account running the Microsoft Dynamics NAV Business Web Services service for the HTTP service, which is the normal service name used by web services.

Resolution

In order to eliminate the login prompts and allow authorized users to view the Web Services URL, you need to add the following SPNs to the domain user account running the Microsoft Dynamics NAV Business Services service.

Now, I'm sure you all know if you use the ADSI Edit snap-in, or another utility such as the LDP or LDAP 3 utilities to incorrectly modify attributes to AD objects you could seriously mess up the AD, so be careful. Also, you need to be a domain admin to make the following changes.

In the ADSI Edit snap-in, expand Domain [DomainName], expand DC= RootDomainName, expand CN=Users, right-click CN= AccountName , and then click Properties. If you are on a server running Windows Server 2008, you may need to first connect and bind to an instance. NotesDomainName is a placeholder for the name of the domain. RootDomainName is a placeholder for the name of the root domain. AccountName is a placeholder for the account that you specify to start the NAV Server service. If you specify a domain user account to start the NAV Server service, AccountName is a placeholder for the domain user account.

In the Properties dialog window locate the servicePrincipalName attribute and double click it to open the Editor Dialog window.

Using the following format enter the following two SPNs individually. Click the Add button to add each SPN.

When finished, click OK, and then OK. Finally close the ADSI Edit window.

Additional Information

Since Kerberos ticket usually expire after 10 hours, you may need to purge the current Kerberos tickets from client machine before the setup of the Microsoft Dynamics NAV Outlook Add-in can be completed in Microsoft Outlook.

With Kerbtray.exe, you can easily verify or remove (or both) Kerberos tickets from any of the associated computers that are being used. To download the Kerbtray utility, visit the following Microsoft Web site:

In NAV 2009, Outlook Synchronization includes the option to use the new Web Services functionality instead of using C/FRONT and NAS. This is great and demonstrates some of the functionality that Web Services has to offer.

One issue that can arise when setting this up in a “3 machine” environment is when configuring the Microsoft Office Outlook Add-In. When selecting a company, you could receive an error similar to one of the following.

The connection to "" Microsoft Dynamics NAV database failed. The program returned the following error: GetCompaniesList error: The login failed when connecting to SQL Server xxx. connection string: NavSynchronizationUrl=http://yyy:7047/DynamicsNAV/WS/Codeunit/DynamicsNAVsynchOutlook;CompanyName=zzz; Please verify your synchronization settings. If the problem persists contact your system administrator.

The connection to "" Microsoft Dynamics NAV database failed. The program returned the following error:GetCompaniesList error: The request failed with HTTP status 401: Unauthorized. connection string: NavSynchronizationUrl=http://yyy:7047/DynamicsNAV/WS/Codeunit/DynamicsNAVsynchOutlook;CompanyName=zzz; Please verify your synchronization settings. If the problem persists contact your system administrator.

Note xxx is the server name of the SQL Server (Database Tier), yyy is the server name of the Dynamics NAV Server (Service Tier), and zzz is the company name.

These errors can occur if NAV Web Services are not setup with the correct SPNs and delegation information. If you haven’t already, make sure your have reviewed the walkthrough on setting up a 3 machine install (found in the nav_install.chm help file, NAV Help can be downloaded here.) and the previous post about setting up NAV 2009 Web Services.

Some partners use the Merge tool in the NAV Developer Toolkit to attempt to merge the FULL set of objects from the old and new versions. This is not necessary and often will cause more problems than it is worth.

For the purpose of discussion, let's say that you are upgrading a database from version 3.70 to 5.0 SP1.

One common error that occurs is something like this...

Your program license does not permit you to delete the IC Partner Code field in the table.

The IC Partner Code field is a field that did not exist in 3.70 but has been added to the 5.0 SP1 database. Most often what we find is that partners are mistakenly trying to import the merged objects into the Customer's database when they receive errors like this. The new fields for 5.0 SP1 do not exist in the customer's database. You will not be able to import the merged text file that you created from the Developer's Toolkit into your customer's database. You must first import the text file into a base Cronus 5.0 SP1 database. Once the import has completed successfully, you will then export all the objects from this database as an fob file, and then you will be able to import the fob into your customer's database.

These program license errors also occur if the object merge is not handled correctly. The main thing to keep in mind is that there will be fields that existed in 3.70 that do not exist in 5.0 SP1 and new fields in 5.0 SP1 that did not exist in 3.70. A partner license will not permit you to delete or create fields in the NAV reserved range. However, this SHOULD NOT be a problem if the object merge is done correctly. Keep in mind that if there have been NO modifications to an object, then there is no need to import a merged version of that object into 5.0 SP1. Any data from 3.70 that needs to be converted will be handled during the data conversion part of the upgrade process. When you run step 1 of the upgradetoolkit, the data that needs to be converted will be moved over to temporary tables and then converted during step 2.

Concentrate on your modified objects. If you are going to use the NDT to perform the merge, try working with only the modified set of objects rather than trying to merge every object in the database. As a matter of fact, it will often be faster to manually re-enter your modifications in the base 5.0 SP1 database than to try to track down all of the errors that can occur with the merge. One option is to use a text compare tool to compare the base 3.70 unmodified table to your modified one, then manually copy and paste your modifications into 5.0SP1. The NDT function Compare Two Versions works well for this purpose. TIP: Make sure before you do a text compare that the language layers in the "Old Base Version" match the "Current Custom Version". This will prevent having nearly every object show differences in the Compare Tool due to captions...

Open a clean Cronus database for your Old Base Version.Go to Tools/Object Designer.Go to Tools/Language Module/ExportSelect a file name on your computer for the export in case you should need it at some time in the future.Select one of the languages that you do not want and then be sure to click the Delete Language text box. Select OK.Repeat for each of the languages that you do not need.

Another thing to keep in mind when using the Merge Tool in the Developer Toolkit is that you usually cannot just Accept All Changes with a set of customized objects, because there are almost always conflicts in code that must be resolved manually. Many developers prefer to use the Compare tool in the toolkit and then copy and paste the changes manually into the new version. Compare and Merge is a tool for developers to use as they see fit, but it is not flawless, so you should always check the suggested changes and resolve any conflicts manually.

I must say that since I started working in the integration area of NAV (from within NAV), I got very interested in the possibilities that it would bring to NAV developers. Back then, I presented a Web Server for the NAS using the Socket ComCom and since then I have seen how people have used the streams and specifically the MSMQ Bus Adapter for integrating services and data.

When writing the code for the STREAMS (InStream and OutStream), I thought it would be very useful to write a function that could copy from one to another, reading from the InStream and writing to the OutStream. However, when using Sockets, there is an essential problem to completing this task. Since TCP data can contain anything (literally any data), and since the data size is also unknown and un-limited, how can we know when the copying has been completed?

Recently I was dealing with a problem that I found within one of the communities forums (yes, we are reading) and it was regarding XMLPorts. You need to stream the data to and from them, so I rapidly wrote a codeunit that would allow me to read the XMLPort to a file; for that, I used the COPYSTREAM function to read from the XMLPort to a FILE. A couple of minutes later, I found out that my file was not filled out correctly as it was truncated, and immediately went into the code to further debug the problem. I quickly found out that the problem was that the COPYSTREAM was not reading till the End of Stream (EOS). I was puzzled to find an error in the COPYSTREAM code after all this years, but of course I thought that the call to the EOS was simply missing. Once I saw that the call was in fact there, it finally hit me…. InStream.EOS is not working, or, it cannot really work.

The real problem here is, how do we know when a stream will not send us more data? Usually this is done through a protocol (like http, ftp, etc) but without a protocol, it is not possible to have a clear rule when we have the EOS. Is it a NULL termination? Is it 2 x CR+LF? Or what about a dot in an empty line? The truth is that, we could make rules, but we cannot have a generic answer to all possibilities.

Depending on your specific conditions, and specially the size of the data you are sending, you might not see this problem at all. But maybe, from time to time, you have noticed that data being received gets truncated and you are trying to figure out what went wrong.

To further illustrate the problem, let’s receive a file using Sockets and Save it on our local file (I’ll skip the sending code unit, but it can very easily be done following the samples provided in the Development Guide for Communication Components):

In the environment where I am writing this, I can send files without any issue up to approximately 25 Kb. After that, everything seems to work fine, except that the file gets truncated, that is, I am trying to send a 48 kb file, but get a truncated one.

In order to get rid of this problem, I suggest copying the stream one char at a time, so the code could look something like:

The retry is necessary, because we cannot rely on InS.EOS. InS.EOS also suffers from the fact that we don’t know when the stream will stop sending us data.

A nicer way to deal with this would be to first send how big the data is. That way, we don’t have to rely on time to assume that the information has indeed completed its transmission. If you are sending XML documents, you could also use the DOMDocument.load(InS) return value, to see if the received data indeed contains a valid XML document. If you have access to codeunit 7700, you can see an example on how this could be achieved (as you need to first copy the stream).

Of course, as mentioned before… This issue will only happen with the raw SocketBusAdapter.

Small tip, if you want to use SQL Server Express 2008 instead of SQL Server Express 2005 which is included in the Microsoft Dynamics NAV 2009 RTM installation, here is what to do:

The Demo installation of NAV 2009 RTM is looking for a instance called MSSQLSERVER, so if this is not detected during install, SQL Server Express 2005 will be installed, and Demo Database will be attached to SQL 2005 even though you might have had SQL 2008 Express installed.

So to avoid this set the Instance to MSSQLSERVER on the SQL Server 2008 Express. This way SQL Server 2008 Express will be used and SQL Server 2005 will not be installed.