Especially after a new installation of IIS role in a server, you may notice that your browser returns “404 Page Not Found” error if you try to visit ASP.NET pages. Files exist and the URL is correct. What to do in this situation?
Solution for 404 error for existing ASP.NET pages
First things first, check if the ASP.NET role is installed. It may seem like an easy change but it is also easy to miss.
Go to “Server Manager > Add roles and features wizard” to check which features are installed under Web Server (IIS) role.
If the you see the required features are installed, there are a few other things to check:
- Check if the website and application pool are running
- Create an HTML file in the application folder and try to browse it. This is for checking if the IIS is functioning in general
- Check if World Wide Web Publishing service is running in Services
- Go to IIS logs to see if there is a sub-status code for the 404 error
- In IIS Manager, go to Request Filtering and make sure there is no rule affecting ASP.NET pages
- Are there other websites hosted in IIS? Check if they work
- Create a new website and application pool to try accessing your ASP.NET pages. There might be a configuration issue in the existing website or application pool
- Check bindings. Check if the bound ports are listened (For more information: Port 80 and 443 are not listened in IIS server)
- In IIS Manager, go to Handler Mappings to make sure ASPX has handlers
- As always, get information about the issue history. Was it working before or it hasn’t worked?
- Make sure the existing files have aspx extension. Make sure to display file extensions so you don’t miss these kind of easy issues (Reference)
- In some servers, you may need to run
aspnet_regiis -iin Command Prompt (Reference)
Try to reset IIS after making changes to ensure changes go into effect right away.