Thanks to visit codestin.com
Credit goes to github.com

Skip to content

QGIS Server Windows PGSERVICEFILE, definition of service [service name] not found #61977

@U676

Description

@U676

What is the bug or the crash?

QGIS version:
3.40.7-Bratislava 'Bratislava', 91d544f

Running on windows, Qgis server 3.40.7 , I'm unable to use a pg_service.conf file.

I've set up a system env variable PGSERVICEFILE and pointed to [path]\pg_service.conf.
In QGIS Desktop the pg_service.conf works, eg. if I change the password then the Qgis Desktop can't access the data related to a layer in the project file. The connection is listed under PGConnections in the "Browser" view.

The QGis server works if i export the data from the layers to shape files and make the project use those as data for the layers. But if i point out the data using the pg service it doesn't work.

LOGs:

13:23:56 INFO Server[2092]: ******************** New request ***************
13:23:56 INFO Server[2092]: Request URL: http://127.0.0.1:8091/qgis_mapserv.fcgi.exe?MAP=C%3A%5Cproject%5Cpublic%5Cdbosm%5Cosm.qgz&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetProjectSettings
13:23:56 INFO Server[2092]: Environment:
13:23:56 INFO Server[2092]: ------------------------------------------------
13:23:56 INFO Server[2092]: SERVER_NAME: 127.0.0.1
13:23:56 INFO Server[2092]: REQUEST_URI: /qgis_mapserv.fcgi.exe?MAP=C%3A%5Cproject%5Cpublic%5Cdbosm%5Cosm.qgz&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetProjectSettings
13:23:56 INFO Server[2092]: SCRIPT_NAME: /qgis_mapserv.fcgi.exe
13:23:56 INFO Server[2092]: PATH_INFO: /qgis_mapserv.fcgi.exe
13:23:56 INFO Server[2092]: HTTPS: off
13:23:56 INFO Server[2092]: REMOTE_ADDR: 127.0.0.1
13:23:56 INFO Server[2092]: REMOTE_HOST: 127.0.0.1
13:23:56 INFO Server[2092]: SERVER_PORT: 8091
13:23:56 INFO Server[2092]: QUERY_STRING: MAP=C%3A%5Cproject%5Cpublic%5Cdbosm%5Cosm.qgz&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetProjectSettings
13:23:56 INFO Server[2092]: REMOTE_USER:
13:23:56 INFO Server[2092]: CONTENT_TYPE:
13:23:56 INFO Server[2092]: REQUEST_METHOD: GET
13:23:56 INFO Server[2092]: AUTH_TYPE:
13:23:56 INFO Server[2092]: SERVER_PROTOCOL: HTTP/1.1
13:23:56 INFO Server[2092]: MAP:C:\project\public\dbosm\osm.qgz
13:23:56 INFO Server[2092]: REQUEST:GetProjectSettings
13:23:56 INFO Server[2092]: SERVICE:WMS
13:23:56 INFO Server[2092]: VERSION:1.3.0
13:23:56 WARNING FCGIServer[2092]: Socket monitoring disabled: no socket fd!
13:23:56 WARNING PostGIS[2092]: Connection to database failed
definition of service "read" not found

13:23:56 WARNING PostGIS[2092]: Connection to database failed
definition of service "read" not found

13:23:56 WARNING PostGIS[2092]: Connection to database failed
definition of service "read" not found

13:23:56 WARNING PostGIS[2092]: Connection to database failed
definition of service "read" not found

13:23:56 WARNING PostGIS[2092]: Connection to database failed
definition of service "read" not found

13:23:56 WARNING PostGIS[2092]: Connection to database failed
definition of service "reader" not found

13:23:56 WARNING PostGIS[2092]: Connection to database failed
definition of service "read" not found

13:23:56 WARNING PostGIS[2092]: Connection to database failed
definition of service "read" not found

13:23:56 WARNING PostGIS[2092]: Connection to database failed
definition of service "read" not found

13:23:56 WARNING PostGIS[2092]: Connection to database failed
definition of service "read" not found

13:23:56 WARNING PostGIS[2092]: Connection to database failed
definition of service "read" not found

13:23:56 WARNING PostGIS[2092]: Connection to database failed
definition of service "read" not found

13:23:56 WARNING PostGIS[2092]: Connection to database failed
definition of service "read" not found

13:23:56 CRITICAL Server[2092]: Error, Layer(s) forest_4776b5d2_d256_416c_ac07_345731487719, lines_6bc7c967_02a7_4d2a_9e46_e3de067f4497, polygons_a516b12d_c2b4_4b12_88c1_b8114d190889, water_3745b924_fe2a_48e9_9fab_d4d0837f6852 not valid in project C:\project\public\dbosm\osm.qgz
13:23:56 WARNING Server[2092]:
Layer(s) not valid

13:23:56 INFO Server[2092]: Request finished in 89 msnition of service "reader" not found

12:42:11 WARNING PostGIS[5696]: Connection to database failed
definition of service "reader" not found

12:42:11 WARNING PostGIS[5696]: Connection to database failed
definition of service "reader" not found

12:42:11 WARNING PostGIS[5696]: Connection to database failed
definition of service "reader" not found

12:42:11 WARNING PostGIS[5696]: Connection to database failed
definition of service "reader" not found

12:42:11 WARNING PostGIS[5696]: Connection to database failed
definition of service "reader" not found

12:42:11 CRITICAL Server[5696]: Error, Layer(s) forest_4776b5d2_d256_416c_ac07_345731487719, lines_6bc7c967_02a7_4d2a_9e46_e3de067f4497, polygons_a516b12d_c2b4_4b12_88c1_b8114d190889, water_3745b924_fe2a_48e9_9fab_d4d0837f6852 not valid in project C:\GIS\Projekt\public\dbosm\osm.qgz
12:42:11 WARNING Server[5696]:
Layer(s) not valid

12:42:11 INFO Server[5696]: Request finished in 95 ms

Steps to reproduce the issue

On a Windows server 2019.
Create a project in Qgisdesktop with a shapefile layer.
Verify it works through QGis Server.
Export layer data to PostgreSQL through DB Manager in QGis Desktop.
create a pg_service.conf and point system env PGSERVICEFILE to it
Add new PostgreSQL connection i QGIS Desktop with service that exist in pg_service.conf.
Add layer from pg to project.
Verify it works on QGis Desktop. Verfiy it doesn't work if you change setting in pg_service.conf. Make it work again.
Try to show the project through QGis Server.
QGis will log that definition of service [servicename] not found

Versions

3.40.7-Bratislava 'Bratislava', 91d544f

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

Metadata

Metadata

Assignees

Labels

BugEither a bug report, or a bug fix. Let's hope for the latter!PostGIS data providerServerRelated to QGIS server

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions