RS First Dynamics NAV Blog


...from NAV 3.60 to NAV 2013
Archivio Posts
Anno 2015

Anno 2014

Anno 2013

Anno 2012

Anno 2011

Anno 2010

Anno 2009

Anno 2008

Anno 2007

Can’t Run the Windows Client (RTC) or Debugger from the Dynamics NAV 2013 Development Environment

Can’t Run the Windows Client (RTC) or Debugger from the Dynamics NAV 2013 Development Environment

For NAV developers, one of the more exciting features of Microsoft Dynamics NAV 2013 is the new Windows Client (RTC) debugger. The redesigned debugger for NAV 2013 and its functional changes will make development faster and programming more stable. For business, that’s a good thing.

Go here for a complete walkthrough of debugging in Microsoft Dynamics NAV 2013

Since NAV 2013 leaves the old Classic Client behind, all objects are now run in the Windows Client. From the development environment, picking an object and hitting the run button will launch the Windows Client.

Microsoft Dynamics NAV Object Designer

Recently I ran into this issue when trying to launch the debugger:

Microsoft Dynamics NAV Server Instances Error

"There are no NAV Server instances available for this database". You must ensure that a NAV Server instance is running and is configured to use the database before you perform this activity.

The Solution?

"You’ll need to restart any middle tier NAV service that connects to the database. There was most likely a company restore to the NAV database in question which causes NAV to remove records that launching the windows client from the development environment relies upon."

Reassigning Default Server Instance

 

The Details

In Dynamics NAV 2013 are three new system tables: Server Instances, Active Session and Session Event.

The Server Instances table tracks NAV Service Tier instances configured to use that particular database when the service starts. The Active Session table records client and user information when connecting to NAV. The Session Event table will track logon/logout type events on a per user basis.

Active Session Table

This table tracks connected client sessions. A NAV developer can use this table to connect to and debug any active NAV session. In Dynamics NAV 2009, NAV developers did not have the ability to debug in the RTC. With 2013 this is no longer a limitation. This will help improve 2013 development as it will be faster to diagnose issues since the Active Session table allows the developer to debug a user’s specific session, seeing any issues or errors as they occur.

Session Event Table

This table tracks logon/logoff events of users. Possible business use could see this table integrated into some type of audit report.

Server Instances Table

You can view this table from the NAV 2013 Development Environment by going to: File -> Database -> Information.

This will allow you to select from the list of running NAV service tier instances. When you run an object from the object designer it will run under that particular service tier instance. This is helpful if multiple people need to debug in a development environment (as you can only have one debugging session per service tier, so you’ll have to create multiple instances if necessary).

An entry in this table is important, without the Instance in this table entries into the Active Session and Session event tables aren’t made and you won’t be able to run an object from the development environment or debug any sessions (see error below).

Trying to run an object from the Development Environment after removing the Instance from Server Instances table results in the error above.

On start up of a Dynamics NAV 2013 Server Instance:

exec sp_executesql N’SELECT TOP 1 “Server Instance ID” FROM dbo.”Server Instance” WHERE “Service Name” = @0 AND “Server Computer Name” = @1 AND “Server Instance Name” = @2 AND “Server Port” = @3',N’@0 nvarchar(13),@1 nvarchar(21),@2 nvarchar(13),@3 int’,@0=N’dynamicsnav70',@1=N’server-name.domain.local’,@2=N’dynamicsnav70',@3=7056

If there is no entry in the [Server Instances] table on start up, NAV will issue the following request to the SQL server:

sp_executesql N’INSERT INTO dbo.”Server Instance”(“Service Name”,”Server Computer Name”,”Last Active”,”Server Instance Name”,”Server Port”) VALUES (@0,@1,@2,@3,@4) SELECT CAST(SCOPE_IDENTITY() AS INT)’,N’@0 varchar(250),@1 varchar(250),@2 datetime,@3 varchar(250),@4 int’,@0=’dynamicsnav70',@1=’server-name.domain.local’,@2=’2013-01-08 03:19:43.153',@3=’dynamicsnav70',@4=7056

This MSDN page describes the [Server Instance] table as being polled periodically, which it is, and the entry for the Instance would be removed if it was inactive for 3 minutes. I wasn’t able to observe this behavior.

Polls for events every 1 minutes:

IF EXISTS (SELECT 1 FROM “Demo Database NAV (7-0)”.”dbo”.”Server Instance” WHERE DATEDIFF(minute, [Last Active], GETUTCDATE()) > 5) INSERT INTO “Demo Database NAV (7-0)”.”dbo”.”Session Event” (“User SID”,”Server Instance ID”,”Session ID”,”Event Type”,”Event Datetime”,”Client Type”,”Database Name”,”Client Computer Name”,”User ID”,”Comment”) SELECT se.”User SID”,se.”Server Instance ID”,se.”Session ID”,4 AS “Event Type”,CASE WHEN (se.”Login Datetime” >= si.”Last Active”) THEN DATEADD( second, 1, se.”Login Datetime” ) ELSE si.”Last Active” END AS “Event Datetime”,se.”Client Type”,se.”Database Name”,se.”Client Computer Name”,se.”User ID”,’Force closed by server’ AS “Comment” FROM “Demo Database NAV (7-0)”.”dbo”.”Active Session” AS se INNER JOIN “Demo Database NAV (7-0)”.”dbo”.”Server Instance” AS si ON si.”Server Instance ID” = se.”Server Instance ID” AND DATEDIFF(minute, si.[Last Active], GETUTCDATE()) > 5

 Restoring a native NAV backup into a database (such as creating a test company) will cause the service tier to delete all entries from the Server Instance table.

declare @p1 int
set @p1=NULL
exec sp_prepexec @p1 output,NULL,N’DELETE FROM [Demo Database NAV (7-0)].[dbo].[Server Instance] ‘
select @p1
a Bill Warnke post
 
Categoria: Dynamics NAV 2013
martedì, 07 mag 2013 Ore. 22.36

Messaggi collegati


Statistiche
  • Views Home Page: 468.790
  • Views Posts: 885.489
  • Views Gallerie: 0
  • n° Posts: 343
  • n° Commenti: 0
Copyright © 2002-2007 - Blogs 2.0
dotNetHell.it | Home Page Blogs
ASP.NET 2.0 Windows 2003