自定义域名映射Azure Web App遇错:资源无法访问求助
Hey Martin, sorry to hear you're stuck with this error after setting up your custom domain between GoDaddy and Azure Web Apps. Let's go through some practical steps to diagnose and fix the issue:
1. Verify DNS Record Propagation & Correctness
DNS changes (especially with GoDaddy) can take up to 24 hours to fully propagate, though it's often faster. Use these commands to check if your records are pointing to the right places:
- For your A record: Run
nslookup yourcustomdomain.comand confirm the returned IP matches the IP address shown in Azure Web App's Custom Domains blade. - For your CNAME record: Run
nslookup www.yourcustomdomain.com(if you set one) and ensure it resolves toyourwebappname.azurewebsites.net. - For the TXT verification record: Run
nslookup -type=TXT yourcustomdomain.comand check that the value matches the verification string provided by Azure.
2. Confirm Azure Domain Validation Status
Head back to the Azure Portal, navigate to your Web App → Custom Domains, and double-check:
- Each domain entry shows a Validated status (no warning icons). If validation failed, click the domain to see the specific error (e.g., mismatched TXT record, incorrect IP).
- Ensure you've added both the root domain (e.g.,
yourdomain.com) and subdomain (e.g.,www.yourdomain.com) if needed.
3. Check if the Default Azure Domain Works
First, confirm your Web App is accessible via its default Azure domain: yourwebappname.azurewebsites.net. If this also returns the same error, the problem isn't with the custom domain mapping—it's with the Web App itself. Troubleshoot that first:
- Check if the Web App is running (in Azure Portal → Overview, ensure the status is Running).
- Verify your deployment completed successfully (check Deployment Center logs).
- Look for application errors in the Log Stream or Diagnose and solve problems tool.
4. Clear Local DNS Cache
Your local machine might be caching old DNS records, causing it to point to the wrong server. Flush the cache with these commands:
- Windows: Open Command Prompt as admin and run
ipconfig /flushdns - Mac: Open Terminal and run
sudo dscacheutil -flushcache - Linux: Run
sudo systemd-resolve --flush-caches(varies by distro)
5. Inspect Web App Routing & Default Pages
If the default Azure domain works but the custom domain doesn't, check your app's routing configuration:
- Ensure your app has a default landing page (e.g.,
index.html,default.aspx,index.php) configured correctly. - If using a framework like ASP.NET Core or Node.js, verify that routing rules aren't blocking access to the root path.
6. Check HTTPS/SSL Configuration (If Enabled)
If you've set up SSL for your custom domain:
- Confirm the SSL certificate is successfully bound to the domain (Azure Portal → Custom Domains → Bind SSL certificate).
- If you've enabled HTTPS Only in the Web App settings, ensure you're accessing the domain via
https://(nothttp://). - Wait a few minutes after binding the certificate—sometimes it takes time for Azure to fully deploy it.
7. Use Azure's Built-in Diagnostics
Azure has a powerful tool to diagnose domain issues:
Go to Web App → Diagnose and solve problems, search for Custom Domain Issues or Web App Down. This tool will scan your configuration and provide targeted fixes based on what it finds.
内容的提问来源于stack exchange,提问作者Martin Muldoon

