You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows 10下Docker LocalStack SNS本地端点收不到消息求助

Troubleshooting SNS Endpoint Issues with LocalStack on Windows 10

Let’s work through this step by step since you’re new to Docker and LocalStack—this is a super common networking gotcha with containerized services! Here are the key fixes and checks to get your C# app receiving SNS messages:

1. Fix the Network Endpoint (Most Likely Culprit)

When LocalStack runs in a Docker container, localhost inside the container refers to the container itself—not your Windows host machine. So when you set the endpoint to http://localhost:8585, LocalStack is trying to send messages to its own internal network instead of your C# app.

On Windows 10, Docker supports host.docker.internal as a hostname that resolves directly to your host machine. Update your subscription command to use this:

Connect-SNSNotification -TopicArn arn:aws:sns:ap-southeast-2:123456789012:mytopic -Protocol http -Endpoint http://host.docker.internal:8585 -EndpointUrl http://localhost:4575

If that doesn’t work, you can also use your Windows machine’s local IPv4 address (find it via ipconfig in PowerShell, look for your active network adapter’s IPv4 address) instead of host.docker.internal.

2. Verify Firewall and App Listener Configuration

  • Windows Firewall: Make sure it’s not blocking incoming requests to port 8585. Temporarily disable it to test, or add an inbound rule allowing traffic to port 8585 for your C# app.
  • App Listening Interface: Ensure your C# app is listening on 0.0.0.0:8585 (not just localhost:8585). If it’s only bound to localhost, it won’t accept connections from the Docker container. Check your app’s startup configuration to confirm the listener is set to accept all network interfaces.

3. Handle SNS Subscription Confirmations

SNS requires HTTP/HTTPS subscriptions to confirm the endpoint before sending messages. Your C# app needs to handle the initial GET request LocalStack sends when you create the subscription:

  • The request will include a Token parameter in the query string.
  • Your app must respond with a 200 OK status and return the token value in the response body.

If you skip this step, the subscription will stay in a "PendingConfirmation" state and no messages will be delivered. Verify the subscription status with this command:

Get-SNSSubscription -TopicArn arn:aws:sns:ap-southeast-2:123456789012:mytopic -EndpointUrl http://localhost:4575

Look for the SubscriptionArn—if it’s still marked as pending, you need to implement the confirmation handler.

4. Check LocalStack Logs for Delivery Errors

View LocalStack’s container logs to spot any issues with message delivery. Run this command in PowerShell to pull the logs:

docker logs <your-localstack-container-id>

Look for entries related to SNS message delivery—you might see errors like "connection refused" or "timeout" that will point directly to the root problem.

5. Confirm LocalStack Port Mapping

Make sure your LocalStack container is properly mapped to port 4575 (the SNS port you’re using). When you started the container, you should have included a port mapping like:

docker run -p 4575:4575 localstack/localstack

Without this mapping, your PowerShell commands won’t be able to communicate with LocalStack’s SNS service at all.

内容的提问来源于stack exchange,提问作者Syed Farabi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 09:59:36