Netstat Filtering

When you perform a netstat -noa you could encounter a huge list with information. To filter through this list use piping. Like this:

netstat -noa | find “13000”

You now only see processes which listens to port 13000.

Advertisements

How to install the NAV Web Client (Web Server Components)

In this article I will explain how to install the Web Server Components for Dynamics NAV 2016.

High-level steps:

1. Install the ‘Web Server Components’ from the Dynamics NAV DVD.
2. Start your internet browser and go to http://yourservername:8080.

More detailed steps:
1. Install the ‘Web Server Components’ from the Dynamics NAV 2016 DVD.
a. Start Setup.exe from the NAV DVD. Choose Custom and Select the option ‘Web Server Components’:

01

Click Next and leave all settings unchanged:

02

Some of the components that now will be installed:

– IIS Web Server
– IIS URL Rewrite Module 2
– Microsoft Dynamics NAV 2016 Web Client
– Language Module for the Microsoft Dynamics NAV 2016 Web Client

2. Start your internet browser and go to http://localhost:8080
a. Start ‘Internet Explorer’ and type in the URL: http://localhost:8080 You will now see the following:

03

b. You must add the name of your default service tier (NAV Instance) to the URL.

In my case it is ‘NST90Test’ so the URL will be:

http://localhost:8080/NST90Test/

04

 

If you want to ‘simulate’ a Tablet Client in your browser go to http://localhost:8080/NST90Test/tablet.aspx
If you want to ‘simulate’ a Phone Client in your browser go to http://localhost:8080/NST90Test/phone.aspx

The steps in this article only work if you install the Web Server Components on the same machine as your Dynamics NAV Server. The steps are quite easy in my opinion.

Want to install the Web Client on another server? Then additional configuration is needed. You can find more info about it on MSDN ‘Walkthrough: Installing the Microsoft Dynamics NAV Web Server Components on Three Computers‘.

If you install the NAV App on your tablet or smartphone it will not work because certificates are mandatory and more configuration is required then. Keep checking this site for more information about how to accomplish these things! More info will be added regularly.

Configuring Database Deadlock Detection and Monitoring

On NAV Techdays 2016 in Antwerpen (Belgium) Microsoft demonstrated a beautiful new feature. Microsoft Dynamics NAV 2017 now offers ‘Database Deadlock Detection and Monitoring’. If NAV 2017 detects a deadlock it will rollback one of the transactions.

If you run the NST under a serviceaccount you need to apply some extra configuration to make this work:

  • Alter any event session
  • Grand View Server State

Go to the properties of your serviceaccount in SSMS and go to the ‘Securables’ tab:

alter-any-event-session

view-server-state

nav-deadlock-monitoring-configuration-sql-server

It’s also possible by executing some T-SQL:

use [master]
GRANT ALTER ANY EVENT SESSION TO [CONTOSO\sa_nav]
use [master]
GRANT VIEW SERVER STATE TO [CONTOSO\sa_nav]

If you don’t do this you will notice errors like this in your application Log:

Server instance: NST2017-RTM
Category: Sql
ClientSessionId: d7ea6dfa-622c-48e1-a6ed-9d5d8402b17c
ClientActivityId: a419d67f-0f56-4394-93cc-b5a1e753344b
ServerSessionUniqueId: 857d43f9-be50-4f2e-abcf-533364da2935
ServerActivityId: 2364cada-9b04-49e4-9268-25260ecdd20f
EventTime: 12/05/2016 16:16:04
Message <ii>Deadlock monitoring feature is enabled but current SQL server user does not have ‘VIEW SERVER STATE’ or ‘ALTER ANY EVENT SESSION’ permissions for the database: NAV2017RTM. Please grant both of those permisions in order to use this feature.</ii>
ProcessId: 4052
Tag: 00000DE
ThreadId: 9
CounterInformation:

By Default DeadLock Monitoring is already enabled on the NAV Service Tier (NST):

enable-deadlock-monitoring

Show OData webservice response directly in IE

As a Technical consultant I need to regularly install new NAV software for our customers. After installing I always try to check if web services are also working. In NAV 2017 I check at least three things:

1. Call the SOAP URL

http://nav01:7047/NST2017-RTM/WS/CRONUS%20Nederland%20BV/Page/SalesOrder
http://nav01.contoso.lan:7047/NST2017-RTM/WS/CRONUS%20Nederland%20BV/Page/SalesOrder

First link contains the hostname. Second link contains the FQDN. Always test with both to ensure it’s working flawless!

2. Call the ODataV3 URL

http://nav01:7048/NST2017-RTM/OData/Company('CRONUS%20Nederland%20BV')/SalesOrder
http://nav01.contoso.lan:7048/NST2017-RTM/OData/Company('CRONUS%20Nederland%20BV')/SalesOrder

3. Call the ODataV4 URL

http://nav01:7048/NST2017-RTM/ODataV4/Company('CRONUS%20Nederland%20BV')/SalesOrder
http://nav01.contoso.lan:7048/NST2017-RTM/ODataV4/Company('CRONUS%20Nederland%20BV')/SalesOrder

Please note: the links of course only work in my Lab environment!

The SOAP URL shows the WSDL so that’s okay:

nav2017-soap-response

Now the ODataV3 URL shows the following response:

nav2017-odatav3-response

This isn’t the response I want to see, however… If I show the source of the page (F5) I see the OData output! So this works also! Normally this is a good thing: Internet Explorer is processing the output as an RSS feed. In this case I don’t want that, so the first thing we should do is to disable this:

Go to Internet options > Content > Settings and disable ‘Turn on feed reading view’. Close the browser and retry.

Now we see the OData response immediately! It took me some time to figure this out so I hope I can save you some time with this handy info! To test the ODataV4 URL there is also a problem with the browser. I will investigate this and share my findings soon!

You do not have access to Microsoft Dynamics NAV. Verify that you have been set up as a valid user in Microsoft Dynamics NAV.

Before you can access Microsoft Dynamics NAV you should be known as a user in the NAV database. (The only exception is when there a created no users at all then everyone will be granted access with SUPER permissions.) So when you haven’t been created (in NAV) as a user you will get the following warning when you try to access the database:

User Not Created

It’s really easy to fix this ‘problem’ with Powershell.

Global steps:

  • Start Powershell ISE
  • Import the NAV Administration Module
  • Run the cmdlet to Add yourself to the NAV database and grant yourself Permissions with another Cmdlet, please see the complete code at the end of this post.
  • Start the Windows Client (NAV)

I would recommend to use Powershell ISE. There are a lot of articles out there on the internet telling all the advantages it has.

How to import the NAV Administration Module:

Import-Module "$env:ProgramFiles\Microsoft Dynamics NAV\90\Service\NavAdminTool.ps1

Please mind that the module can only be loaded from the NAV Service Tier (NST) server, because the module is part of the NAV Administration Tools. Next, add the Windows Account you are using to start NAV with New-NAVServerUser:

New-NAVServerUser -ServerInstance $ServerInstance -WindowsAccount $WindowsAccount -Verbose

Adding yourself as a user isn’t enough. You also need to specify  which permission you have in NAV (authorization). If you are created as a user and try to start NAV you will now get the following warning:

No Permissions

This means you have no or not enough permissions although NAV knows who you are (authenticated) but that doesn’t mean you have the permission to read/start/do anything. So, in this example we will give the Windows account SUPER permissions (the highest privilege) in NAV. You can do this in Powershell with the New-NAVServerUserPermissionSet Cmdlet:

New-NAVServerUserPermissionSet -ServerInstance $ServerInstance -WindowsAccount $WindowsAccount -Verbose

Please replace $WindowsAccount with the User you want to give access and replace $Serverinstance with the proper NAV Instance. Below an example script where you only have to replace the ServerInstance variable. The script is automatically retrieving your current domain name and username. Let PowerShell work for you as much as possible… :)

$WindowsAccount = "$env:userdomain\$env:USERNAME"
$ServerInstance = "DynamicsNAV90"
Import-Module "$env:ProgramFiles\Microsoft Dynamics NAV\90\Service\NavAdminTool.ps1"
New-NAVServerUser -ServerInstance $ServerInstance -WindowsAccount $WindowsAccount -Verbose
New-NAVServerUserPermissionSet -ServerInstance $ServerInstance -WindowsAccount $WindowsAccount -PermissionSetId 'SUPER' -Verbose

If you want to learn more about the NAV Security System please check MSDN ‘Security and Protection

 

 

SQL Server Database States

In my daily job as a Technical Consultant I regularly work with  NAV and the SQL databases it’s using . I’ve seen (or set SQL) databases in the following states (in SQL Server):

Read-Only The database can be set to this mode if the data shouldn’t be updated.
Single User In single user mode only one user is allowed acces. In some situations it’s neccesary to perform maintenance tasks in Single mode.
Restricted User In restricted user mode only users with the sysadmin or dbcreator role  can access the database.
Offline Database is not available for access.
Emergency In Emergency mode you can use DBCC CHECKDB to bring the database back online again.
Recovery Pending If for example the logfile is damaged or corrupted, the database will be in this state. Action by the DBA is needed to resolve the error.

In SSMS2016 (SQL Server Management Studio 2016):

Database States in SQL 2016

Note: this is not an exhausting list of all the states. My advice is to check the File States Article on MSDN  for more information. Please also use Google for more advanced information about other database states like ‘Suspect’,’Recovery Pending’ etc.

For some states to enable I’ve used TSQL. Below you can find them:

CREATE DATABASE [Demo Database NAV (9-0) DB2]
ALTER DATABASE [Demo Database NAV (9-0) DB2] SET SINGLE_USER

CREATE DATABASE [Demo Database NAV (9-0) DB3]
ALTER DATABASE [Demo Database NAV (9-0) DB3] SET RESTRICTED_USER

CREATE DATABASE [Demo Database NAV (9-0) DB4]
ALTER DATABASE [Demo Database NAV (9-0) DB4] SET Offline

CREATE DATABASE [Demo Database NAV (9-0) DB5]
ALTER DATABASE [Demo Database NAV (9-0) DB5] SET Emergency

Configuration and personalization in NAV 2016

The Role Tailored Client (RTC) or Windows Client for Dynamics NAV 2016 has a different Role Center for each type of User. Everytime you start NAV this page will be your ‘starting point’. For example, if a user has the Profile ‘Order Processor’ then he or she will see the ‘Order Processor’ role center. So the interface is RoleTailored to the user as much as possible.  This Role Center reflects his/her tasks, views and priorities. It’s possible however to change the default ‘look and feel’ by customizing the Role Center. You could for example hide or display elements in your NAV ribbon or change the visibility of fields, actions, factboxes or fasttabs. By default personalization is enabled. It’s possible to disable personalization by adding the -disablepersonalization parameter. Example:

"C:\Program Files (x86)\Microsoft Dynamics NAV\90\RoleTailored Client\Microsoft.Dynamics.Nav.Client.exe" -disablepersonalization

Note: if you disable personalization it’s still possible to change the width of your columns for example. These settings are saved locally to ‘PersonalizationStore.xml’. This file can be found in the Appdata folder, example: ‘C:\Users\YourUsername\AppData\Roaming\Microsoft\Microsoft Dynamics NAV’. In  NAV 2009 the column width was stored in a ZUP file.

Besides user personalization it’s also possible to use the ‘Configuration Mode’. Configuration Mode allows configuration for a NAV Profile. So after customizing a profile the changes will affect all users who are assigned to this profile. This ‘base layer’ of customizations could then be personalized by the user. But it’s also possible to prevent this so your users can’t personalize NAV. This way you could protect users from their selves and assure that all users of a certain profile see the same buttons, field etc. This could ease support tasks for example.

In order to work in configuration mode to customize a profile you need to specify the parameter -configure. Example:

"C:\Program Files (x86)\Microsoft Dynamics NAV\90\RoleTailored Client\Microsoft.Dynamics.Nav.Client.exe" -configure

For more information you could also visit MSDN ‘How to: Open Microsoft Dynamics NAV in Configuration Mode

Another way to disable profile personalization for users: Go to: Departments/IT Management/RoleTailored Client/Profiles. Next, select the Disable Personalization checkbox for the profile you want to disable personalization.

Disable Personalization