Computers and modern gadgets

The task of a 1C developer is not only to write code, but also to track and correct errors, build an optimal command execution algorithm and optimize the speed of work, that is, debugging. It is difficult to do this without using the functionality of the built-in debugger of server procedures.

Initially, debugging mode is disabled on 1C servers, so the developer will have to do simple manipulations with the settings in order to be able to thoroughly check the code.

Enabling debugging mode on the server for the 1C platform version 8.2 and higher

The algorithm for enabling debugging is quite simple. It does not assume in-depth knowledge of operating system architecture and 1C administration. However, you should still be very careful, because debugging work is performed directly on the server and with administrator rights. Therefore, if you do not have thorough knowledge, strictly follow the algorithm of actions without improvisation:

  • Stop the 1C:Enterprise Server Agent service through Server Manager. If the setup takes place on a production server, then you should take care in advance about the absence of 1C users in the database;
  • Launch the system registry editor by clicking “Start” - “Run” or the keyboard shortcut “Win” + “R”. In the window that opens, enter the line “regedit”;
  • In the registry you need to find the item;

  • Among the parameters, find “ImagePath” and change it by adding “-debug” to the existing value with a space at the end;
  • Through the Server Manager, start the service that was stopped - “1C:Enterprise Server Agent”.

Enabling debugging mode on the server for 1C version 8.1

If you need to enable debugging mode on platform 8.1, the algorithm of actions remains virtually unchanged. The only change is the location of the "ImagePath" path parameter. In version 8.1 it is located in the section.

1C developers advise enabling debugging mode exclusively for test servers, where the code should be debugged. The reason for this recommendation is because of the performance impact that occurs when debugging is enabled on the server. If you have many users or the server power leaves much to be desired, take this advice carefully so that debugging does not have negative consequences.

In order to be able to debug server procedures, you need to set the flags in the “Service->Parameters” form of the configurator:

Debugging on the application server

This is described in the documentation:

Book “1C:Enterprise 8.1. Configuration and administration"

Chapter 18. Configuration Tools

Debugger and performance measurements

"Debugging code on the server

To install debug mode, you should start the 1C:Enterprise server with the /Debug command line switch (ragent.exe /debug)."

The server agent startup keys are described in the book:

"1C:Enterprise 8.1. Client-server. Features of installation and use"

"Running the server agent as a service

If, when installing a server cluster, you selected the option of launching the central server agent as a service, then this service will be launched automatically during the installation process and will also be launched when the operating system starts.

If the central server agent was installed as an application, then it is possible to register the service manually and then launch it.

Service registration is performed with the following command:

Ragent.exe -instsrvc -usr<пользователь>-pwd<пароль>-port<порт>-range<диапазоны>-seclev<уровень>-debug | -rmsrvc | -start | -stop

Instsrvc – registering the cluster agent as a Windows service. If ragent.exe is launched with this key, it registers in the list of Windows services and exits. Not compatible with -srvc, -rmsrvc switches;

Usr<имя пользователя>

Pwd<пароль пользователя>– the name and password of the Windows user under whose name ragent.exe should be launched as a Windows service. Can only be used in conjunction with the -instsrvc switch when registering ragent.exe as a Windows service;

Port<порт>– number of the main port of the cluster agent. This port is used by the cluster console to access the central server. The cluster agent port is also specified as the working server IP port;

Range<диапазоны>– IP port ranges for dynamic selection. From these, service ports of cluster processes are selected if it is impossible to select them from the settings of the corresponding working server. Default: 1560-1591. Example values<диапазоны>: "45:49", "45:67,70:72,77:90";

Seclev<уровень>– security level of the cluster agent process. Determines the security level of connections established with the ragent.exe process.<уровень>can take the following values: 0 (default) connections are not secure, 1 – secure connections only for the duration of user authentication, 2 – permanently secure connections.;

Rmsrvc – unregisters the cluster agent as a Windows service. If ragent.exe is launched with this key, then it cancels its registration in the list of Windows services and exits. Not compatible with -srvc, -daemon, -instsrvc switches.

Start - launch ragent.exe, registered as a Windows service. Launches ragent.exe, previously registered as a Windows service, and then exits;

Stop - stop ragent.exe registered and running as a Windows service. Stops ragent.exe, previously registered and running as a Windows service, and then exits;

Debug - launching a server cluster in configuration debugging mode. "

Thus, if the 1C:Enterprise server was launched as a service and for some reason it should also be launched as a service in debug mode, you must first unregister the service (the -rmsrvc key), and then re-register the service with the -debug key.

Obviously, a similar effect can be achieved in other ways, for example, by directly editing the Windows registry. To do this, you should probably consult your Windows documentation.

Works only when the "-debug" key is set in the registry. In all other cases it doesn't work for some reason.

"ImagePath"=

was "F:\Program Files\1cv81\bin\ragent.exe" -srvc -agent -regport 1541 -port 1540 -range 1560:1591 -d "F:\Program Files\1cv81\server"

set "F:\Program Files\1cv81\bin\ragent.exe" -srvc -agent -regport 1541 -port 1540 -range 1560:1591 -debug -d "F:\Program Files\1cv81\server"

18.10.2016

Debugging on a 1C server (8.2, 8.3...)

If the 1C database is running in a client-server version, the code debugging mode on the server side is disabled. Therefore, it will not be possible to see step by step what happens when executing a function or procedure. To enable server-side debugging, you need to follow a few simple steps.

Enable debugging on the 1C:Enterprise server 8.2, 8.3

The first thing you need to do is stop the 1C:Enterprise server service. Go to "Start - Run" (or the keyboard shortcut "Windows + R"), write "services.msc" (of course you need to open Windows services management from the Administrator)

After stopping, open the Windows registry editor ("Start - Run" (or the keyboard shortcut "Windows + R") and write "regedit"), and find the branch with the name "" or "" depending on platform version


We are interested in the registry key named "ImagePath". Add "-debug" to the end of the key value. This means that the debugging mode on the 1C server side is activated.
Was: "C:\Program Files\1cv8\8.3.6.2530\bin\ragent.exe" -srvc -agent -regport 1541 -port 1540 -range 1560:1591 -d "C:\Program Files\1cv8\srvinfo"
Became: "C:\Program Files\1cv8\8.3.6.2530\bin\ragent.exe" -srvc -agent -regport 1541 -port 1540 -range 1560:1591 -d "C:\Program Files\1cv8\srvinfo" -debug


Save and start the 1C service. All is ready! Happy debugging!

How to start debugging on a 1C server...

By default, when using the 1C:Enterprise client-server architecture, the 1C code debugging mode works only on the client side. Server procedures and functions are not visible to the client machine.

To enable the use of debugging on the 1C server, you must perform the following steps:

1. Find and stop the “1C:Enterprise Server Agent 8.3” service in the service manager (for version 8.3).

2. Open the system registry editor. You can use the command line or the Start - Run... menu tool and the command regedit.

3. Find the branch in the registry:

  • For version 1C 8.1
  • For version 1C 8.2
  • For version 1C 8.3

4. Change the ImagePath property, add the “-debug” directive to the end of the line. You will get the following property line: “C:\Program Files (x86)\1cv8\8.3.6.2152\bin\ragent.exe” -srvc -agent -regport 1541 -port 1540 -range 1560:1591 -d “C:\Program Files (x86)\1cv8\srvinfo" –debug

After this, the 1C server code can be safely checked with a debugger and breakpoints can be set wherever required.

This article talks about how to enable debugging on a 1C server 8.1, 8.2 and 8.3 on Windows and Ubuntu operating systems.

In addition, I note that this article is part of a small series of articles about debugging in 1C:

  • How to enable debugging on a 1C server

Enable debugging on the 1C server in Windows

Launch the registry editor by running the regedit command (using Win+R or Start->Run).

You can read more about HTTP debugging and the debug server in the next article in the series.

Enable debugging on the 1C server in Ubuntu

First we install the server:

sudo service srv1cv83 stop

After this, open the /etc/init.d/srv1cv83 file as superuser and find the line in it:

And we bring it to this form:

Then we start the server again:

sudo service srv1cv83 start

In the configurator on the client machine, go to “Settings” -> “Launch 1C:Enterprise” -> “Advanced” and enable two items:

  • "Set debug enable mode"
  • "Start debugging at startup"

You can read about how to install a 1C server on Ubuntu 16.04/18.04.

That's all, I hope this article was useful to you. Let me also remind you about other articles in the series about debugging in 1C; links to them can be found at the beginning of this article.

If you notice an error, select a piece of text and press Ctrl+Enter
SHARE:
Computers and modern gadgets