user4612290 user4612290 - 26 days ago 10
ASP.NET (C#) Question

"The resource cannot be found" when opening a page in IIS hosted web application

I'm hosting a web application (.Net 4.5) to a remote server using IIS 8.5. The application runs well locally and on the remote IIS, however there is a single page "/Reports/ReportsMain.aspx" that causes the error "The resource cannot be found." I made sure that the page exists.
I also made sure that the .Net version for the application pool is set to 4.0.However I noticed the following:

1- When I accessed this page remotely for the first time I got a browser "Login" popping up, although there should be no authentication here at all

2- The error page shows at the bottom "Version Information: Microsoft .NET Framework Version: 2.0, ASP.NET Version: 2.0 " although I've set the application pool to 4.0

What could be the problem ?

Answer Source

A couple things to try

  • Make sure there is not a duplicate site in IIS that is capturing the request
  • Restarting IIS is never a bad option
  • Make the web.config itself is set to target framework 4.0 and not 2.0

Usually when this happens where it works fine locally but not when deployed it always turns out to be the third item, a web.config configuration mis-match. Hope this helps!