fbarresi / SoftBeckhoff

Virtual Beckhoff PLC for local testing with docker support
MIT License
91 stars 9 forks source link

Can't read/write virtual plc when running it from Docker #9

Open emmanuelbertho opened 1 year ago

emmanuelbertho commented 1 year ago

Hello, I am trying your virtual-plc and I have an issue. When I start the program on my machine everything works fine and I can read and write values in ADS. But when I am starting it in Docker, I can't read and write values in my plc. I have an exception : TwinCAT.Ads.AdsErrorException : 'Target port could not be found. (AdsErrorCode: 6, 0x6)'

image

Here is the log of my container :

dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] Application Directories dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]

dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] ApplicationPath: /app/SoftBeckhoff.dll dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] BaseDirectory: /app/ dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] CurrentDirectory: /app dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] Configuration dbug: TwinCAT.Ads.AdsRouterService.RouterService[0]

dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] ASPNETCORE_ENVIRONMENT: Production Provider: ChainedConfigurationProvider Provider: JsonConfigurationProvider Provider: JsonConfigurationProvider Provider: EnvironmentVariablesConfigurationProvider Provider: CommandLineConfigurationProvider Provider: JsonConfigurationProvider Local System: SoftBeckhoff, 192.168.1.20.1.1, 172.17.0.5

Configured routes: RemoteSystem1, 10.30.2.124.1.1, RemoteSystem1

dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] Starting remote listeners ... dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] Starting listening on 172.17.0.5:48898 dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] Waiting for Request to AmsTcpIpRouter (192.168.1.20.1.1) dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] [AmsTcpIpRouter] Start Listener dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] Opening Loopback listener '127.0.0.1:48898' dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] [AmsTcpIpRouter] Start Listener info: Microsoft.Hosting.Lifetime[0] Now listening on: http://[::]:80 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Production info: Microsoft.Hosting.Lifetime[0] Content root path: /app info: SoftBeckhoff.Services.BeckhoffService[0] Initializing Beckhoff server... info: SoftBeckhoff.Services.BeckhoffService[0] Beckhoff server created dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] Opening Loopback listener '127.0.0.1:48898' dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] [AmsTcpIpRouter] Start Listener dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] [AmsTcpIpRouter] TCP Connect Endpoint: 127.0.0.1:37776 dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] Port '852' occupied! info: TwinCAT.Ads.AdsRouterService.RouterService[0] AdsServer with AmsPort '192.168.1.20.1.1:65535' registered! dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] Starting Receive AdsServer '192.168.1.20.1.1:65535 (Endpoint: 127.0.0.1:37776)' registered! dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] --> Sending Frame: TcpFrame Flags: PortConnect, DataSize: 8 (TcpFrameSize: 14) dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] --> Send TcpFrame: TcpFrame Flags: PortConnect, DataSize: 8 (TcpFrameSize: 14) info: TwinCAT.Ads.AdsRouterService.RouterService[0] AdsServer '192.168.1.20.1.1:852' connected! (2 loopback connections active) info: SoftBeckhoff.Services.BeckhoffService[0] Beckhoff server connected = True with result = 852 info: Microsoft.Hosting.Lifetime[0] Application is shutting down... dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] A task was canceled. dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] [AmsTcpIpRouter] TCP Disconnect Endpoint: 127.0.0.1:37776 dbug: TwinCAT.Ads.AdsRouterService.RouterService[0] Loopback listener '127.0.0.1:48898' closed!

Do you know what could cause that ?