Azure网站绑定自定义域名后出现'/应用程序'运行时错误及web.config配置咨询
First, let's confirm your web.config setup: your <customErrors mode="Off"/> configuration is correct for ASP.NET Framework apps, but there are a few other angles to check since you're still seeing the generic error page. Here's what to try next:
Verify Azure App Service's built-in error settings
Azure sometimes overrides web.config configurations with its own portal settings. Head to your App Service in the Azure portal, navigate to Configuration > General settings, find the Error pages section, and set Custom errors to Off. This ensures detailed error details are exposed to remote visitors.Check your custom domain binding & validation status
Make sure your custom domain is fully validated in Azure (check the Custom domains blade for any warning icons). Confirm your DNS records (A or CNAME) are pointing to the correct App Service IP or default domain. If you're using SSL, double-check that the certificate is properly bound, hasn't expired, and you've selected the right SSL type (SNI or IP-based) for your setup. Mismatched SSL bindings are a frequent cause of this kind of runtime error.Enable and review Azure's application logs
Generic runtime errors often hide specific backend issues in logs. Go to Monitoring > Log stream in your App Service to view real-time error logs, or enable Application logging (Filesystem) under Monitoring > App Service logs and download the log files later. These logs will show the exact exception—like missing dependencies, permission issues, or routing problems—that's causing the failure.Add httpErrors configuration to your web.config
For IIS-hosted apps (which Azure App Service uses), the<system.webServer>section'shttpErrorssetting can override the<customErrors>rule. Add this block to yourweb.configto ensure detailed errors are displayed:<configuration> <!-- ... your existing configuration content ... --> <system.webServer> <httpErrors errorMode="Detailed" /> </system.webServer> </configuration>Test locally with hosts file (optional)
If you can, modify your localhostsfile to map your custom domain to your App Service's public IP. Then access the domain from your local browser—this helps rule out DNS or network-level issues that might be blocking detailed error visibility.
内容的提问来源于stack exchange,提问作者Nic Bowles

