![]() |
#1 |
Участник
|
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 C ![]() 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:
Freddy Kristiansen PM Architect Microsoft Dynamics NAV Подробнее
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
![]() |
#2 |
Участник
|
Хотелось бы вернуться к этому в связи с 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 C ![]() 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:
Ролевой центр у меня работает. См. скриншоты alexef: Выпущен международный релиз Navision 2009 (W1). однако этого сервиса не вижу и localhost/DynamicsNAV у меня не появился. База на SQL2005. 1. Что я недоустановил? 2. Действительно ли в вышедшей NAV2009 код компилируется в C#? При каких условиях? 3. Что-то я не вижу сервера. Клиента - вижу. Что нужно поставить, чтобы был сервер? 4. Где об этом написано подробнее? |
|
![]() |
#3 |
Участник
|
|
|
![]() |
#4 |
Участник
|
хм... если нет сервера, то в C# не компилируется или компилируется?
|
|
![]() |
#5 |
Участник
|
Как я понял из статьи - конверит стандартный клиент в момент компиляции:
Цитата:
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).
|
|
![]() |
#6 |
Участник
|
а что же тогда выполняется, если я ничего не компилил, а папка с cs-файлами у меня отсутствует?
|
|
![]() |
#7 |
Участник
|
А почему должна быть папка с 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.
Да и вообще, этот средний уровень, представляется мне, будет тормознутым, если на лету будет компилить объекты... Может быть проще будет делать web-приложения, возможность использовать web-сервисы для обмена данными... Но подключаться простым клиентом в любом случае придется через Citrix или VPN - как и сейчас. |
|
![]() |
#8 |
Участник
|
Цитата:
Сообщение от .Quattro.
![]() А почему должна быть папка с cs файлами?
Товарищ пишет, что когда "Сервисному уровеню" нужно выполнить код из объекта, то C# код из объекта записывается на диск и "волшебным образом" компилируется в модуль, который потом динамически подгружается, позволяя "сервисному уровню" заменять кодеюниты (я правильно понял???), страницы (page которые) на лету. Как я понял, что если пользоваться стандартным клиентом, то остается тоже 2ух уровневое приложение. Да и вообще, этот средний уровень, представляется мне, будет тормознутым, если на лету будет компилить объекты... Может быть проще будет делать web-приложения, возможность использовать web-сервисы для обмена данными... Но подключаться простым клиентом в любом случае придется через Citrix или VPN - как и сейчас. А зачем так? |
|
![]() |
#9 |
Участник
|
Стандартный клиент к C# не имеет никакого отношения, за исключением того, что умеет генерить С# код для кодеюнитов и, возможно, page'ов. В Page вообще можно программировать или они только на просмотр?
И так сделано для совместимости, думаю. У меня просто нет 2009 нава, я, в основном, предполагаю, как это реализовано. |
|
![]() |
#10 |
Участник
|
Цитата:
Их можно редактировать здесь же, в НАВ (это отдельный вид типа ХХ-портов, менюсьют и кодеюнитов). Все объекты (в большей части формы), по идее, будут "трансформированы" в такой вид (как-то здесь пробегала дока ещё относящаяся к 6.0 по этому поводу). |
|
![]() |
#11 |
Участник
|
Цитата:
Если не включать отладку, то исходный код на c# не появляется. Похоже появляются только библиотеки (интересно где?) Если включить отладку, то файлы с исходным кодом на c# появляются как описано здесь Clausl: Debugging in NAV 2009 Обратите внимание, что база данных и файлы находятся в ProgramData! Ох, надо подумать. Особенно в свете того, что 1cv8.2 также использует трансляцию в промужеточный язык http://axforum.info/forums/showthread.php?...8998#post178998 http://demo-ma.1c.ru/ Какие выгоды это несет? Какие недостатки? См. также сообщение от belugin http://axforum.info/forums/showthread.php?...9068#post179068 |
|
![]() |
#12 |
MCTS
|
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#. |
|