Most of my clients require a running NAV Application Server.  The NAS that is included in NAV 2009 R2 requires a license that is included in most licenses today.  However, there are cases where more than one NAS is needed.  That requires additional NAS licenses.  Where the customer is running NAV 2009 R2 middle tier service this changes.  By running a VB.NET NAV Application Server it is possible to setup multiple services on a single CAL license.  The CAL license is not as expensive as the NAS license.  Here is the solution that I offer.

First, I create a codeunit in NAV

[code htmlscript=”false”]ExecuteCodeunit(CodeunitID : Integer;Log : Boolean) Success : Boolean

IF Log THEN LogEntryNo := InsertLogEntry(5,CodeunitID);
Success := CODEUNIT.RUN(CodeunitID);
IF Log THEN
UpdateLogEntry(LogEntryNo,Success)
ELSE IF NOT Success THEN BEGIN
LogEntryNo := InsertLogEntry(5,CodeunitID);
UpdateLogEntry(LogEntryNo,Success)
END;

InsertLogEntry(ObjectType : ‘,,,Report,,Codeunit’;ObjectNo : Integer) : Integer
WITH JobQueueLogEntry DO BEGIN
INIT;
ID := CREATEGUID;
“User ID” := USERID;
“Start Date/Time” := CURRENTDATETIME;
“Object Type to Run” := ObjectType;
“Object ID to Run” := ObjectNo;
INSERT(TRUE);
COMMIT;
EXIT(“Entry No.”);
END;

UpdateLogEntry(LogEntryNo : Integer;WasSuccess : Boolean)
WITH JobQueueLogEntry DO BEGIN
GET(LogEntryNo);
“End Date/Time” := CURRENTDATETIME;
IF WasSuccess THEN
Status := Status::Success
ELSE BEGIN
Status := Status::Error;
SetErrorMessage(COPYSTR(GETLASTERRORTEXT,1,1000));
END;
MODIFY;
COMMIT;
END;[/code]

This codeunit uses the Job Queue Log to log the execution.  Next step is to publish this codeunit as a web service in table no. 2000000076.  Default web service name is NAVAppServer.

On the server you install the following files (in my case to C:\Program Files (x86)\Dynamics.is\VB.NET NAV Application Server)


Next step is to edit the VB.NET NAV Application Server.exe.config file and customize the values.

To install as a service start command prompt in elevated mode and execute installutil.exe command.  The install will prompt for the user to start the service.

The last step is to change the service startup and start the service.

The service will create entries in the Application Log.

NAV Web Service Codeunit

The following ZIP files are encrypted.

VB.NET NAV Application Server DEFAULT Executables

NAV App Server Visual Studio 2008 Project

11 thoughts on “VB.NET NAV Application Server

  1. Very elegant solution, Gunnar!
    This will certainly save customers some headaches license-wise.

    Great work 🙂

    I love reading your technical posts on Dynamics NAV.
    Keep up the great work 🙂

  2. Very nice solution indeed.

    Does this Application Server support the use of .NET Interop in the jobs that it runs?

    1. Yes, it does support .NET interop.

  3. moulikaku says:

    Hi Gunnar, may i know the password for VB.NET NAV Application Server DEFAULT Executables file please

  4. David says:

    Hi Gunnar,

    I’ve just purchased your product and set it up but I’m getting the issue ‘Execution of codeunit 81004 failed’. Also I get an email advising ‘the remote name could not be resolved: ‘skyrr-sql-kro-1’. It seems to still want to use the web service in the original config file you provided.

    I have updated the config file with the appropriate web service URL and also ensured we do have access in our license to run the codeunits.

    Can you please assist.

    1. Sending the source code to you via email.

  5. David says:

    Hi Gunnar,

    Have you sent through the source code as I have not received it.

    1. Drop me an email,þI will reply

  6. Malik79 says:

    Hi Gunnar,

    I’ve just purchased your programm and I’m having the same issue as David.
    Is it possible to get the Source Code?

Leave a Reply

%d bloggers like this: