Azure Web Apps部署后显示微软默认页,如何修改应用服务主页?
Hey there! I’ve run into this exact issue dozens of times—deploying an app to Azure Web Apps only to see that generic Microsoft welcome page instead of your hard work. Let’s break down why this happens and how to fix it, plus how to set your app’s homepage properly.
Why You’re Seeing the Default Page
First, let’s troubleshoot the root cause:
- Deployment didn’t target the right folder: Azure looks for your app files in the
wwwrootdirectory. If your deployment tool (like GitHub Actions, Azure CLI, or VS Code) uploaded files to a subfolder insidewwwroot(e.g.,wwwroot/my-app), Azure can’t find your entry point. Check the deployment logs or use the Kudu console (go toyour-app-name.scm.azurewebsites.net) to verify files are in the root ofwwwroot. - Default document doesn’t match your homepage: Azure checks a predefined list of default filenames (like
index.html,default.html,index.php) in order. If your homepage has a different name (e.g.,home.html), Azure skips it and shows the default page. - Incorrect startup command (for dynamic apps): For Node.js, .NET, Python, etc., if your app’s entry file isn’t the default expected by Azure (like
app.jsfor Node), it won’t start properly, falling back to the welcome page.
How to Set/Change Your App’s Homepage
Let’s cover the most common scenarios:
1. Update Default Documents via Azure Portal
This is the go-to fix for static sites or apps where your homepage is a static file:
- Go to your Azure Web App in the portal.
- On the left sidebar, click Configuration > Default documents.
- Click Add and type the exact filename of your homepage (e.g.,
home.html,landing-page.html). - Use the up arrow to move your new entry to the top of the list—Azure checks files in order, so putting yours first ensures it’s prioritized.
- Save the changes and restart your Web App.
2. Set Startup Command for Dynamic Apps
For apps like Node.js, .NET Core, or Python where you need to run a server:
- Node.js: If your entry file isn’t
app.jsorserver.js, either update yourpackage.jsonto include"start": "node my-custom-entry.js", or go to Configuration > General settings in the portal, and enternode my-custom-entry.jsin the Startup command field. - .NET Core: Ensure your
Program.cshas the correct routing setup (e.g., mapping to your homepage controller). Alternatively, in the portal’s Default documents list, add your app’s default route filename (likeIndex.cshtmlif using Razor Pages). - Python: Set the startup command to point to your WSGI app, e.g.,
gunicorn --bind=0.0.0.0 --workers=4 my_app:app.
3. Fix Subfolder Deployments
If your app is deployed to a subfolder inside wwwroot:
- Go to Configuration > Virtual applications and directories in the portal.
- Click Add to create a new entry:
- Virtual path: Enter
/(to map the root URL to your subfolder). - Physical path: Enter
site\wwwroot\your-subfolder-name(replace with your actual subfolder). - Uncheck Convert to application unless you need it for a separate app.
- Virtual path: Enter
- Save and restart your Web App.
Once you make these changes, give your Web App a quick restart—this ensures Azure picks up the new settings. In most cases, your app’s homepage should load right away!
内容的提问来源于stack exchange,提问作者Deepak Bolla

