HTTP 404.0 Error Local IIS Site - asp.net

I have several IIS sites running on my local machine running IIS 8. 3 of the sites work perfectly fine, the 4th returns a 404.0 Error:
"HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. "
I have tried everything I can think of but nothing will work. To save people some time I will list some of the things I tried:
Adding UrlRoutingModule to my Web.config
Removing the WebDAVModule
Adding ExtentionlessURLHandlers
I have also confirmed that the path is correct and the site is in the correct application pool. I am running out of things to try everything I see on the web seems to say one of these things I tried will fixed it but it hasn't. My IIS local web server seems to be installed corrected as my other sites work fine, please help!!

After a very frustrating day I solved my issue, and it was really due to my last of MVC routing knowledge. I was attempting to navigate to "localhost/example" which had not controller routing associated with it because I had no home controller. I either needed to map a home controller to it, change the default controller to map to one of my existing controllers, or the easiest fix was to navigate to "localhost/example/controllername" where "controllername" is the name of the controller that I wanted to start at. I hope this can save someone else hours of time.

Related

API setup missing something?

I am setting up a web api for the first time and I have another project for reference. It is a .NET framework project that will have a React frontend. I am running it using Visual Studio and IIS Express.
I have no build errors when I start the api project. It has swagger added so I can test database calls, so I know the api itself is working. But I am missing adding something as I am looking to add more security to it.
I am trying to verify authentication and I want to use integrated Windows authentication. When I set a break point, the user in the HttpContext.Current is never set and is never authenticated, so I can't add any authorization filters.
I went back to just the basic empty api project that has the frontend web pages removed to see if I removed something and it shows the same issue. So I either removed it again or I am actually missing adding something.
I am not sure where to look for what is missing, so any pointers would be appreciated.
The left browser is what I am expecting and the right browser is what I am seeing.
I don't need the directory browse turned on, so seeing a 403.14 - Forbidden is fine. But I am clearly missing something to get to that point. Is there a better way to figure out which resource/dependency is causing this error?
I can also see the working version requested url is what I am expecting, but the other is just a /.
Is there a way to resolve that if this is the error?
I can add code snippets if needed, but I haven't yet as I am not sure where the issue is.
I ended up finding the answer using blank test web apis to see what I may have left in that wasn't needed. The project was set up using this option:
After removing the views, etc., to make it strictly an api project. I started removing references (and clearing the associated errors) and seeing what happened with the build after each change.
Under the App_Start folder, there were some additional files that weren't present in the project I had for comparison - FilterConfig, and RouteConfig - which were also called in the Global.asax.
I removed the call in Global.asax for all three and I was able to see the expected http error page.
I dont have enough reputation for a comment, but you got 404 error, which, as you know, means there is nothing on that url. So check the route config and startup.cs Edit: I am on the phone so I didnt saw you already solved it. Good :)

resource cannot be found error when launching an asp application

So I am just in utter disgust at what happened. i was working on an asp.net in TFS application and all of the sudden it literally just stopped working. Every time I tried to launch it in a browser it would display this error:
The entire DESCRIPTION states:
Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make
sure that it is spelled correctly
I haven't the slightest clue what happened. I have not to my best recollection done anything to jeopardize it.
This is what I've done. since I have two different logins to my computer, I took the solution and tried to launch it in my 2nd login and it worked perfectly. I took that same solution file and tried to launch it in my current login and it's causing this issue.
I reset all my Visual studio settings and tried to launch the solution and again - get the same error.
It is showing the SERVIER ERROR in /HOME.aspx - but this error does not show up in my other login.
Does anyone have any idea what could cause this? I'm basically looking at creating a new user profile for myself to get this resolved. Any help will be much appreciated.
Could it be my user profile or would simply re-installing VS could resolve it?

Resource Not Found - 404

So, I've copied a few methods from one controller to another, moved the respective views into the correct view folder and tried to debug my project..
After trying to navigate to one of the newly copied methods and views I get hit with this lovely error.
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /subscriber/addphonenumber
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.57.0
Now, I've double and triple checked that the views are in the right folder, even deleted them, went to the controller actions, right click -> add view and copied the view code over and still no joy.
The controller actions are there, the views are there, what gives?
I've tried cleaning the project, the solution, closing VS and restarting and still... nothing.
Also, when debugging, my breakpoints are never getting hit on the newly copied methods... Not sure what is going on there.
Note: I have NOT made any changes whatsoever to any of the routing configuration, I simply copied the ChangePassword, AddPhoneNumber and VerifyPhoneNumber actions/views from the Manage Controller and Views folder to my Subscriber Controller. These methods and views worked fine before I moved them.
Questions:
Why is Visual Studio not hitting my breakpoints
Why are these views and controller actions not being recognized?
EDIT
I resolved this issue, check below to see my answer.
The solution in my case ended up being this.
I had an area in my project with the same name as a controller in the root controllers folder, that was causing a routing issue and in turn the 404 error. The routing issue prevented my actions from being found, hence the breakpoints not being hit. After removing or renaming the area, everything seems to be working fine.
Project Structure
areas/subscriber - empty
controllers/subscriber
views/subscriber/index
views/subscriber/addphonenumber

Tomcat 6 constantly redirecting URL to old one

I've done a lot of searching and not found anything like this, but I might not be using the right terms. My problem is this:
On a Tomcat 6 server, I originally deployed a Spring Webflow app with a context root of fred - to access it people went to myserver.com:8080/fred
The Spring code in that app changed all requests to have /spring after the context root - so the URL above would become myserver.com:8080/fred/spring - and this would bring up the index page.
That was all fine & dandy.
I rewrote the app to use Spring MVC instead, for reasons too boring to mention here, and as part of this removed the code that performed the /spring piece.
I am now trying to deploy it to the same Tomcat instance. It appears to deploy fine (after undeploying the old one).
However when I try to hit myserver.com:8080/fred to get the index page, it redirects to myserver.com:8080/fred/spring, and naturally this fails as that URL is not supported.
I've checked my config within the WAR, and also scanned through the following places in Tomcat:
conf directory
conf/catalina and subdirectories
webapps and subdirectories
work and subdirectories
I can't see anything referring to this /spring url rewrite. It does deploy and work successfully on my local version of Tomcat.
Could anyone offer any suggestions? All help is appreciated.
Sounds like your browser cached the redirect. If your site at myserver.com:8080 used hard redirects (301 Moved Permanently) to send users from /fred to /fred/spring your browser will remember that the next time you access the application. Try emptying the browser cache and trying again.
That would explain why everything is dandy on your local machine

Why would an aspx file return 404 ("The page cannot be found")

Why when I access an aspx (e.g., http://www.example.com/foo.aspx - not the real site) through IE6 would I get a 404 Error (i.e., "The page cannot be found") in IIS6
I've got scripts enabled for the website and I've tried with executables enabled as well.
Here is the full error:
The page cannot be found
The page you are looking for might have been removed, had its name changed, or
is temporarily unavailable.
------------------------------------------------------------------------------
Please try the following:
Make sure that the Web site address displayed in the address bar of your
browser is spelled and formatted correctly.
If you reached this page by clicking a link, contact the Web site
administrator to alert them that the link is incorrectly formatted.
Click the Back button to try another link.
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)
------------------------------------------------------------------------------
Technical Information (for support personnel)
Go to Microsoft Product Support Services and perform a title search for the
words HTTP and 404.
Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for
topics titled Web Site Setup, Common Administrative Tasks, and About Custom
Error Messages.
I can get to Default.htm in the same directory, so I know the path is right. I've opened it up to everyone (temporarily) so I know the permissions are right.
It could be a lot of things. I had this issue today because .NET had not been re-initialized after installing IIS (aspnet_regiis -i -enable or equivalent).
Check that the anonymous user under which the site runs has read access to the file foo.aspx.
IIS6 and later uses a 404 response, thereby not letting an attacker know whether such a file even exists.
I just happened to find another culprit for this issue. My foo.aspx page referenced a particular master page that had a <%# Register %> directive to a user control that did not exist. Removing the reference to the non-existent user control caused my foo.aspx to load instead of 404.
I found a solution here.
The real catch was using this:
Response.TrySkipIisCustomErrors = true;
The site is pointing to a different directory where the page is not.
It could be permissions, however I would think you would get an access error instead.
I'm assuming you are running IIS.
Check that www.example.com is going to the site that you think it is.
If you are hosting multiple sites on the same IP using host headers you may want to double check the name you are using is going to the site you think it is.
Ray and Joe probably have it. In order to serve any file type, IIS has to have a mapping for it. Aspx files require that they be mapped to the AspNet ISAPI dll, which the .Net installation normally takes care of. If you install IIS after .Net (and I'm sure there are other situations), you have to initiate this yourself by running aspnet_regiis.
ALTERNATE SOLUTION (same error perhaps different cause).
I had installed Visual Studio 2008 Pro without SQL Express it, and it caused this same error. Reinstallation of VS2008 with sql express included seemed to have corrected the problem, or perhaps the install took other actions. I did try to register ASP.net numerous times prior but no luck however it is definitely the most probable cause Just posting my experience for those pulling their hair as I was..
Thanks
If you register the .NET 4 version of IIS, you may find it's grabbed the registration of the aspx extension. If ASP.NET v4 is prohibited then 404 will be returned
I had this issue where some customers were reporting the 404.0 and some didn't have the problem at all(same page). I was able to navigate to any of the pages with no problems from my machine. Some customers would refresh and it would go away. I am using .Net 4.5.2 and IIS 7.5.
Looking at the IIS log file I would see:
sc-status sc-substatus sc-win32-status
404 0 2
sc-status.sc-substatus: 404.0 - Not Found
sc-win32-status: 2 - ERROR_FILE_NOT_FOUND
https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx
https://en.wikipedia.org/wiki/HTTP_404
I found the problem was I had deployed a new version of the website in which the old version of the website had RouteConfig.cs/FriendlyUrlSetting setup by creating a project using the web forms template. The new version was created using an empty template. So obvious to me now.. no URL routing. Customers had a cache issue with certain pages on their machine(no .aspx extension) and having them clear browser data ultimately fixed the problem.
I got this issue when I tried using a different drive to host my apps. I ended up moving them to the wwwroot folder because it was working there and I did not have to time figure out why it is not working on the E:\ drive.
I had bin\roslyn compiler missing. Adding that all worked fine.
Check for double quote errors. I started getting a 404 on a single page because I accidentally had this:
<asp:TemplateField HeaderText="ImageURL"">
instead of this:
<asp:TemplateField HeaderText="ImageURL">
For an aspx page, error 404 can be quite misleading! I have seen all the answers and they presuppose assuming various issues with the file, page, path, etc. but the simplest issues is the fact that if there is an error in your asp page (i.e bad format, improper usage of control, etc. asp will think the page does not exist and will post a 404 when in all actuality, it is easy to ascertain if there is a bad format by simply clicking on design mode. If the page does not render no need to do anything else but look at what is causing the render error, fix and viola'! Your page shows since it was never missing or can't be found, but it simple did not know how to display! Too often people go looking for the wrong solutions and waste so much time! Hope this helps somone. :-)

Resources