Skip to content

System.UnauthorizedAccessException: Access to the path '/app/wwwroot/ControllerStates/PxWeb.Controllers.Api2.Admin.DatabaseController.json' is denied. #25

@reactormonk

Description

@reactormonk

I followed the docker instructions from https://www.pxtools.net/PxWeb2/documentation/docker/

$ git clone https://github.com/PxTools/PxWebApi.git
Cloning into 'PxWebApi'...
remote: Enumerating objects: 16472, done.
remote: Counting objects: 100% (900/900), done.
remote: Compressing objects: 100% (481/481), done.
remote: Total 16472 (delta 708), reused 428 (delta 419), pack-reused 15572 (from 5)
Receiving objects: 100% (16472/16472), 16.18 MiB | 31.04 MiB/s, done.
Resolving deltas: 100% (11095/11095), done.
$ cd PxWebApi/docker/pxwebapi/Database
mv /tmp/px-x-1106010100_102.px /tmp/px-x-1106010100_106.px .
$ ...
$ docker compose up          
[+] Running 21/21
 ✔ web Pulled                                                                                           4.4s 
   ✔ 2d35ebdb57d9 Pull complete                                                                         2.0s 
   ✔ 9f6853c712d5 Pull complete                                                                         2.4s 
   ✔ a5b2b14a7418 Pull complete                                                                         2.4s 
   ✔ 91db49f3082a Pull complete                                                                         2.5s 
   ✔ 4d781a732075 Pull complete                                                                         2.5s 
   ✔ a9f90162b821 Pull complete                                                                         2.5s 
   ✔ 571f7b893311 Pull complete                                                                         2.7s 
   ✔ f2a9b263ee05 Pull complete                                                                         2.8s 
   ✔ 5cd9e5f1a0f6 Pull complete                                                                         3.4s 
   ✔ ff3d8eb984a5 Pull complete                                                                         3.4s 
 ✔ api Pulled                                                                                           4.6s 
   ✔ f637881d1138 Pull complete                                                                         0.8s 
   ✔ 885dbf89963f Pull complete                                                                         0.8s 
   ✔ 065fe5442d2a Pull complete                                                                         0.9s 
   ✔ 49fecc66cb21 Pull complete                                                                         2.4s 
   ✔ d19ff52ef0ad Pull complete                                                                         2.4s 
   ✔ 0b9fdba2015e Pull complete                                                                         2.7s 
   ✔ 5e9b6ca36be0 Pull complete                                                                         3.2s 
   ✔ e144699172a9 Pull complete                                                                         3.2s 
   ✔ 81d5d9e283bb Pull complete                                                                         3.7s 
[+] Running 3/3
 ✔ Network pxweb-demo_default  Created                                                                  0.1s 
 ✔ Container pxweb-demo-api-1  Created                                                                  0.0s 
 ✔ Container pxweb-demo-web-1  Created                                                                  0.0s 
Attaching to api-1, web-1
api-1 ->  | fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz
api-1 ->  | fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/community/x86_64/APKINDEX.tar.gz
api-1     | Starting!
api-1     | 2025-11-05 18:55:28,080 [1] INFO  PCAxis.Paxiom.GroupRegistry - GroupRegistry created
api-1     | 2025-11-05 18:55:28,094 [5] INFO  PCAxis.Paxiom.GroupRegistry - Start loading groupings from /app/wwwroot/Aggregations
api-1     | 2025-11-05 18:55:28,097 [5] ERROR PCAxis.Paxiom.GroupRegistry - Error loading the valueset file: /app/wwwroot/Aggregations/REGION-EN.vs, Error message: Cannot marshal 'parameter #1': Invalid managed/unmanaged type combination (String parameters and return types must be paired with LPStr, LPWStr, or LPTStr).
api-1     | 2025-11-05 18:55:28,097 [5] ERROR PCAxis.Paxiom.GroupRegistry - Error loading the valueset file: /app/wwwroot/Aggregations/REGION-SV.vs, Error message: Cannot marshal 'parameter #1': Invalid managed/unmanaged type combination (String parameters and return types must be paired with LPStr, LPWStr, or LPTStr).
api-1     | 2025-11-05 18:55:28,097 [5] INFO  PCAxis.Paxiom.GroupRegistry - Finished loading groupings from /app/wwwroot/Aggregations
api-1 ->  | (1/9) Installing brotli-libs (1.1.0-r2)
api-1 ->  | (2/9) Installing c-ares (1.34.5-r0)
api-1 ->  | (3/9) Installing libunistring (1.2-r0)
api-1 ->  | (4/9) Installing libidn2 (2.3.7-r0)
api-1 ->  | (5/9) Installing nghttp2-libs (1.64.0-r0)
api-1 ->  | (6/9) Installing libpsl (0.21.5-r3)
api-1 ->  | (7/9) Installing zstd-libs (1.5.6-r2)
api-1 ->  | (8/9) Installing libcurl (8.14.1-r2)
api-1     | 2025-11-05 18:55:28,465 [1] INFO  Microsoft.Hosting.Lifetime - Now listening on: http://[::]:8080
api-1     | 2025-11-05 18:55:28,468 [1] INFO  Microsoft.Hosting.Lifetime - Application started. Press Ctrl+C to shut down.
api-1     | 2025-11-05 18:55:28,469 [1] INFO  Microsoft.Hosting.Lifetime - Hosting environment: Development
api-1     | 2025-11-05 18:55:28,469 [1] INFO  Microsoft.Hosting.Lifetime - Content root path: /app
api-1 ->  | (9/9) Installing curl (8.14.1-r2)
api-1 ->  | Executing busybox-1.37.0-r13.trigger
api-1 ->  | OK: 48 MiB in 28 packages
api-1 ->  | HTTP/1.1 202 Accepted
api-1 ->  | Content-Length: 0
api-1 ->  | Date: Wed, 05 Nov 2025 18:55:28 GMT
api-1 ->  | Server: Kestrel
api-1 ->  | 
api-1     | 2025-11-05 18:55:28,908 [11] ERROR Microsoft.Extensions.Hosting.Internal.Host - BackgroundService failed
api-1     | System.UnauthorizedAccessException: Access to the path '/app/wwwroot/ControllerStates/PxWeb.Controllers.Api2.Admin.DatabaseController.json' is denied.
api-1     |  ---> System.IO.IOException: Permission denied
api-1     |    --- End of inner exception stack trace ---
api-1     |    at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError)
api-1     |    at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
api-1     |    at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
api-1     |    at System.IO.File.OpenHandle(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
api-1     |    at System.IO.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
api-1     |    at PxWeb.Code.BackgroundWorker.ControllerState.Save() in /source/PxWeb/Code/BackgroundWorker/ControllerState.cs:line 43
api-1     |    at PxWeb.Code.BackgroundWorker.ControllerState.AddEvent(Event e) in /source/PxWeb/Code/BackgroundWorker/ControllerState.cs:line 26
api-1     |    at PxWeb.Code.BackgroundWorker.ControllerState.Begin() in /source/PxWeb/Code/BackgroundWorker/ControllerState.cs:line 32
api-1     |    at PxWeb.Code.BackgroundWorker.LongRunningService.ExecuteAsync(CancellationToken stoppingToken) in /source/PxWeb/Code/BackgroundWorker/LongRunningService.cs:line 28
api-1     |    at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
api-1     | 2025-11-05 18:55:28,918 [11] FATAL Microsoft.Extensions.Hosting.Internal.Host - The HostOptions.BackgroundServiceExceptionBehavior is configured to StopHost. A BackgroundService has thrown an unhandled exception, and the IHost instance is stopping. To avoid this behavior, configure this to Ignore; however the BackgroundService will not be restarted.
api-1     | System.UnauthorizedAccessException: Access to the path '/app/wwwroot/ControllerStates/PxWeb.Controllers.Api2.Admin.DatabaseController.json' is denied.
api-1     |  ---> System.IO.IOException: Permission denied
api-1     |    --- End of inner exception stack trace ---
api-1     |    at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError)
api-1     |    at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
api-1     |    at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
api-1     |    at System.IO.File.OpenHandle(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
api-1     |    at System.IO.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
api-1     |    at PxWeb.Code.BackgroundWorker.ControllerState.Save() in /source/PxWeb/Code/BackgroundWorker/ControllerState.cs:line 43
api-1     |    at PxWeb.Code.BackgroundWorker.ControllerState.AddEvent(Event e) in /source/PxWeb/Code/BackgroundWorker/ControllerState.cs:line 26
api-1     |    at PxWeb.Code.BackgroundWorker.ControllerState.Begin() in /source/PxWeb/Code/BackgroundWorker/ControllerState.cs:line 32
api-1     |    at PxWeb.Code.BackgroundWorker.LongRunningService.ExecuteAsync(CancellationToken stoppingToken) in /source/PxWeb/Code/BackgroundWorker/LongRunningService.cs:line 28
api-1     |    at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
api-1     | 2025-11-05 18:55:28,918 [11] INFO  Microsoft.Hosting.Lifetime - Application is shutting down...
api hook exited with status 7
$ docker --version
Docker version 28.5.1, build e180ab8ab8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions