AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 29.10.2008, 22:30   #1  
Blog bot is offline
Blog bot
Участник
 
25,644 / 848 (80) +++++++
Регистрация: 28.10.2006
My first technical blog post is going to describe some details about the service tier, that some people might find interesting (and some people might think that this is common knowledge:-))


What is the Service Tier?
Very briefly - the Service Tier is the middle tier in a Microsoft Dynamics NAV 2009 installation. This is where all database access is performed and all business logic is executed, meaning also that this is where the application is running. The Database Tier needs to be SQL Server 2005 or higher and the Client Tier needs to be the Role Tailored Client. When installed, the Service Tier does nothing but to wait for a connection from a Role Tailored Client, so even if the Service Tier is started it really doesn't consume a lot of resources until some Clients connects to it.

The Service Tier can also be configured as a Web Service listener making part of your application accessible from any Web Service Consumer. It is not recommended that you expose Web Services Directly on the Internet due to security - but you could easily create a high level proxy for some Web Services and expose those to the Internet.

The Role Tailored Client doesn't connect to the SQL Server directly at all - and the SQL Server could in fact be hidden behind a firewall and be inaccessible from the clients.

When a Client connects to the Service Tier he is authenticated using Windows Authentication and the Service Tier will impersonate the user when connecting to the Database Tier. The Service Tier of course needs permission to do that, we cannot have random computers on the network running around impersonating users - more on this topic later.


What is installed?
When you install Microsoft Dynamics NAV 2009 (The Demo install), the installer will create 2 services for you:

Microsoft Dynamics NAV Business Web Services
Service Name: MicrosoftDynamicsNavWs
This is the Web Service listener. By default this is set to start Manually and without starting this service - you will not be able to do anything with Microsoft Dynamics NAV 2009 Web Services.

Microsoft Dynamics NAV Server
Service Name: MicrosoftDynamicsNavServer
This is the Service Tier. By default this service is set to start Automatically.

Both services are set to run as the NETWORK SERVICE user, and by default the Web Service listener has a dependency on the HTTP protocol.

This is what you can see when looking at properties for the service in the services list (Control Panel -> Administrative Tools -> Services).

Another interesting thing pops up if you query the Service Controller for info about the services:



Notice that the services are running with a flag called WIN32_SHARE_PROCESS - meaning that even though you start both services, your task list will only reveal one process running:



Why is this important?

First of all - the two processes share caches of metadata, memory consumption and everything - meaning that you will save some memory when running in the same process.

Secondly if you at some point want to restart your service tier in order to flush these caches - you actually need to restart both services to achieve that goal.


Configuration of the Service Tier
The default installation path of Microsoft Dynamics NAV 2009 varies according to version and language of the operating system - but on my machine it is under:

C:Program FilesMicrosoft Dynamics NAV60

Note that if you install on a 64bit computer, it will be installed C:Program Files (x86) because the Service Tier in NAV 2009 is 32bit only.

In this directory you will find a folder called Service (if you installed the demo) and in this directory a configuration file called:

CustomSettings.config

Among the keys in the config file you will find the following 5 keys:

DatabaseServer / DatabaseName
These values are used when the Service Tier connects to the Database Tier - this is the location of your SQL Server and the name of the Database you want to connect to.

After changing these values, you need to restart the Service Tier (both services if started) in order to make the Service Tier connect to a new database.

It seems cumbersome if you are working as a single user using multiple databases - but one Service Tier has one database connection - that is just the way it is.

If you have multiple databases, you want to install multiple Service Tiers - and I will create a post on how to do this. You can also install multiple Service Tiers connecting to the same databases and you can do that on the same computer if you would want that.

ServerInstance / ServerPort / WebServicePort
These are the values that differentiates multiple service tiers on one box.
The default ServerInstance installed by the installer is DynamicsNAV, the default serverport is 7046 and the default WebServicePort is 7047.

Again - for one Service Tier, these values are fine.

On the Client computer you will connect to a Service Tier using the Select Server dialog, in which you specify the URL of the Service Tier as:

localhost/DynamicsNAV

or

localhost:7046/DynamicsNAV

as you can see - the server URL contains the computername of the Service Tier computer, the port and the Service  Tier instance and if you have multiple Service Tiers, one of these has to be different.

Also the WebService listener uses the Instance in the URL needed to connect to WebServices

http://localhost:7047/DynamicsNAV/WS/<c...me>/Services

More about this in a later post on web services.

BTW. Microsoft recommends that you use the Instance name to differentiate between service tiers and not ports.


Is the Service Tier interpreting C/AL code?
As you probably already know, the answer to this question is No. In NAV 2009

The majority of the Service Tier is written in C# and runs managed code and the application is also converted into C# and at runtime executed as compiled managed Code.

The way this happens is, that whenever you compile an object in C/SIDE, the object is behind the scenes compiled to C# (by the classic client) and the C# code is stored in the Object Metadata table (in the BLOB field called User Code). Furthermore the Object Timestamp field in the Object Tracking table is updated allowing the Service Tier to pickup these changes. When the Service Tier needs to run code from an object - the C# code from the object is written to disk and through some magic compiled into a module, which is loaded dynamically, allowing the Service Tier to replace single code units, pages etc. on the fly.

The directory in which the Service Tier stores the C# files can be found in:

<Program Data>MicrosoftMicrosoft Dynamics NAV60Server<process ID>source

where <Program Data> is

Cocuments and SettingsAll UsersApplication Data on my XP and my Windows 2003 Server and
C:UsersAll Users on my Vista box

and the process ID can be found in the Task Manager by choosing to show the PID column.

Having the C# files available in this directory actually allows you to debug this code as described in Claus Lundstrøm's post:

http://blogs.msdn.com/clausl/archive/2008/...n-nav-2009.aspx

but note that:
  • You will be debugging the C# code - and you cannot see the AL code
  • You will have to install SP1 on VS2005 or VS2008 in order to debug
  • You are debugging the Service Tier meaning that you debug every connection (can be pretty confusing:-))
Enjoy

Freddy Kristiansen
PM Architect
Microsoft Dynamics NAV




Подробнее
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Старый 18.11.2008, 20:44   #2  
mazzy is offline
mazzy
Участник
Аватар для mazzy
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
29,472 / 4494 (208) ++++++++++
Регистрация: 29.11.2001
Адрес: Москва
Записей в блоге: 10
Хотелось бы вернуться к этому в связи с alexef: Выпущен международный релиз Navision 2009 (W1).
и c В NAV 2009 код C/AL конвертится в C#, а что же будет в DAX?


Цитата:
Сообщение от Blog bot Посмотреть сообщение
Very briefly - the Service Tier is the middle tier in a Microsoft Dynamics NAV 2009 installation. This is where all database access is performed and all business logic is executed, meaning also that this is where the application is running. The Database Tier needs to be SQL Server 2005 or higher and the Client Tier needs to be the Role Tailored Client. When installed, the Service Tier does nothing but to wait for a connection from a Role Tailored Client, so even if the Service Tier is started it really doesn't consume a lot of resources until some Clients connects to it.

...

On the Client computer you will connect to a Service Tier using the Select Server dialog, in which you specify the URL of the Service Tier as: localhost/DynamicsNAV or localhost:7046/DynamicsNAV

Is the Service Tier interpreting C/AL code?
As you probably already know, the answer to this question is No. In NAV 2009

The majority of the Service Tier is written in C# and runs managed code and the application is also converted into C# and at runtime executed as compiled managed Code.

The way this happens is, that whenever you compile an object in C/SIDE, the object is behind the scenes compiled to C# (by the classic client) and the C# code is stored in the Object Metadata table (in the BLOB field called User Code). Furthermore the Object Timestamp field in the Object Tracking table is updated allowing the Service Tier to pickup these changes. When the Service Tier needs to run code from an object - the C# code from the object is written to disk and through some magic compiled into a module, which is loaded dynamically, allowing the Service Tier to replace single code units, pages etc. on the fly.

The directory in which the Service Tier stores the C# files can be found in:

<Program Data>MicrosoftMicrosoft Dynamics NAV60Server<process ID>source

where <Program Data> is

Cocuments and SettingsAll UsersApplication Data on my XP and my Windows 2003 Server and
C:UsersAll Users on my Vista box

and the process ID can be found in the Task Manager by choosing to show the PID column.

Having the C# files available in this directory actually allows you to debug this code as described in Claus Lundstrøm's post:

http://blogs.msdn.com/clausl/archive/2008/...n-nav-2009.aspx

but note that:
  • You will be debugging the C# code - and you cannot see the AL code
  • You will have to install SP1 on VS2005 or VS2008 in order to debug
  • You are debugging the Service Tier meaning that you debug every connection (can be pretty confusing:-))
При установке международного NAV2009 я выбрал вариант для develop'ера.
Ролевой центр у меня работает. См. скриншоты alexef: Выпущен международный релиз Navision 2009 (W1).
однако этого сервиса не вижу и localhost/DynamicsNAV у меня не появился. База на SQL2005.

1. Что я недоустановил?
2. Действительно ли в вышедшей NAV2009 код компилируется в C#? При каких условиях?
3. Что-то я не вижу сервера. Клиента - вижу. Что нужно поставить, чтобы был сервер?
4. Где об этом написано подробнее?
Миниатюры
Нажмите на изображение для увеличения
Название: 1.PNG
Просмотров: 351
Размер:	89.3 Кб
ID:	10372  
__________________
полезное на axForum, github, vk, coub.
Старый 18.11.2008, 23:36   #3  
mazzy is offline
mazzy
Участник
Аватар для mazzy
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
29,472 / 4494 (208) ++++++++++
Регистрация: 29.11.2001
Адрес: Москва
Записей в блоге: 10
хм... Clausl: Debugging in NAV 2009
__________________
полезное на axForum, github, vk, coub.
Старый 18.11.2008, 23:47   #4  
mazzy is offline
mazzy
Участник
Аватар для mazzy
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
29,472 / 4494 (208) ++++++++++
Регистрация: 29.11.2001
Адрес: Москва
Записей в блоге: 10
хм... если нет сервера, то в C# не компилируется или компилируется?
__________________
полезное на axForum, github, vk, coub.
Старый 19.11.2008, 13:46   #5  
.Quattro. is offline
.Quattro.
Участник
Лучший по профессии 2009
 
194 / 22 (1) +++
Регистрация: 22.05.2006
Как я понял из статьи - конверит стандартный клиент в момент компиляции:
Цитата:
whenever you compile an object in C/SIDE, the object is behind the scenes compiled to C# (by the classic client) and the C# code is stored in the Object Metadata table (in the BLOB field called User Code).
Старый 19.11.2008, 14:17   #6  
mazzy is offline
mazzy
Участник
Аватар для mazzy
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
29,472 / 4494 (208) ++++++++++
Регистрация: 29.11.2001
Адрес: Москва
Записей в блоге: 10
Цитата:
Сообщение от .Quattro. Посмотреть сообщение
Как я понял из статьи - конверит стандартный клиент в момент компиляции:
а что же тогда выполняется, если я ничего не компилил, а папка с cs-файлами у меня отсутствует?
__________________
полезное на axForum, github, vk, coub.
Старый 19.11.2008, 15:04   #7  
.Quattro. is offline
.Quattro.
Участник
Лучший по профессии 2009
 
194 / 22 (1) +++
Регистрация: 22.05.2006
А почему должна быть папка с cs файлами?
Товарищ пишет, что когда "Сервисному уровеню" нужно выполнить код из объекта, то C# код из объекта записывается на диск и "волшебным образом" компилируется в модуль, который потом динамически подгружается, позволяя "сервисному уровню" заменять кодеюниты (я правильно понял???), страницы (page которые) на лету.
Цитата:
When the Service Tier needs to run code from an object - the C# code from the object is written to disk and through some magic compiled into a module, which is loaded dynamically, allowing the Service Tier to replace single code units, pages etc. on the fly.
Как я понял, что если пользоваться стандартным клиентом, то остается тоже 2ух уровневое приложение.
Да и вообще, этот средний уровень, представляется мне, будет тормознутым, если на лету будет компилить объекты...
Может быть проще будет делать web-приложения, возможность использовать web-сервисы для обмена данными...

Но подключаться простым клиентом в любом случае придется через Citrix или VPN - как и сейчас.
Старый 19.11.2008, 16:08   #8  
mazzy is offline
mazzy
Участник
Аватар для mazzy
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
29,472 / 4494 (208) ++++++++++
Регистрация: 29.11.2001
Адрес: Москва
Записей в блоге: 10
Цитата:
Сообщение от .Quattro. Посмотреть сообщение
А почему должна быть папка с cs файлами?
Товарищ пишет, что когда "Сервисному уровеню" нужно выполнить код из объекта, то C# код из объекта записывается на диск и "волшебным образом" компилируется в модуль, который потом динамически подгружается, позволяя "сервисному уровню" заменять кодеюниты (я правильно понял???), страницы (page которые) на лету.


Как я понял, что если пользоваться стандартным клиентом, то остается тоже 2ух уровневое приложение.
Да и вообще, этот средний уровень, представляется мне, будет тормознутым, если на лету будет компилить объекты...
Может быть проще будет делать web-приложения, возможность использовать web-сервисы для обмена данными...

Но подключаться простым клиентом в любом случае придется через Citrix или VPN - как и сейчас.
т.е. двухуровневый клиент не занимается трансляцией в C#, а выполняет непосредственно C/AL?
А зачем так?
__________________
полезное на axForum, github, vk, coub.
Старый 19.11.2008, 17:22   #9  
.Quattro. is offline
.Quattro.
Участник
Лучший по профессии 2009
 
194 / 22 (1) +++
Регистрация: 22.05.2006
Стандартный клиент к C# не имеет никакого отношения, за исключением того, что умеет генерить С# код для кодеюнитов и, возможно, page'ов. В Page вообще можно программировать или они только на просмотр?

И так сделано для совместимости, думаю.

У меня просто нет 2009 нава, я, в основном, предполагаю, как это реализовано.
Старый 19.11.2008, 17:55   #10  
RedFox is offline
RedFox
Участник
 
1,441 / 10 (0) +
Регистрация: 28.12.2004
Адрес: Киев
Цитата:
Сообщение от .Quattro. Посмотреть сообщение
Стандартный клиент к C# не имеет никакого отношения, за исключением того, что умеет генерить С# код для кодеюнитов и, возможно, page'ов. В Page вообще можно программировать или они только на просмотр?
Насколько я понял, Page просто "прописывают" каким образом и где буду данные отображаться.
Их можно редактировать здесь же, в НАВ (это отдельный вид типа ХХ-портов, менюсьют и кодеюнитов). Все объекты (в большей части формы), по идее, будут "трансформированы" в такой вид (как-то здесь пробегала дока ещё относящаяся к 6.0 по этому поводу).
Старый 23.11.2008, 11:18   #11  
mazzy is offline
mazzy
Участник
Аватар для mazzy
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
29,472 / 4494 (208) ++++++++++
Регистрация: 29.11.2001
Адрес: Москва
Записей в блоге: 10
Цитата:
Сообщение от mazzy Посмотреть сообщение
т.е. двухуровневый клиент не занимается трансляцией в C#, а выполняет непосредственно C/AL?
Да, все так. Новый клиент транслирует в C# и выполняет.
Если не включать отладку, то исходный код на c# не появляется. Похоже появляются только библиотеки (интересно где?)
Если включить отладку, то файлы с исходным кодом на c# появляются как описано здесь Clausl: Debugging in NAV 2009

Обратите внимание, что база данных и файлы находятся в ProgramData!


Цитата:
Сообщение от mazzy Посмотреть сообщение
А зачем так?
Ох, надо подумать.
Особенно в свете того, что 1cv8.2 также использует трансляцию в промужеточный язык
http://axforum.info/forums/showthread.php?...8998#post178998
http://demo-ma.1c.ru/

Какие выгоды это несет? Какие недостатки?
См. также сообщение от belugin http://axforum.info/forums/showthread.php?...9068#post179068
__________________
полезное на axForum, github, vk, coub.
Старый 23.11.2008, 13:46   #12  
apanko is offline
apanko
MCTS
MCBMSS
Лучший по профессии 2009
 
1,164 / 139 (7) +++++
Регистрация: 24.02.2005
NAV Team: Microsoft Dynamics NAV 2009 Ships!
Код:
On the server tier, we've taken advantage of .NET once again.  C/AL business logic written in C/SIDE now compiles down to MSIL via a C# transformation.
...
I mentioned before, the business logic in Microsoft Dynamics NAV 2009 is converted from C/AL to MSIL via C#.
Код на С# я нашел (и без отладчика), а вот где он преобразовывается в MSIL и в .NET DLL пока не видел (или .NET DLL и MSIL - это одно и тоже, кто грамотный - поясните?).
 


Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 05:40.