ASP.NET Friendly URLs 404 errors - asp.net

When I start a web app by loading a page deep in the site, I consistently get a 404 error when using ASP.NET Friendly URLs.
I can reproduce this by:
Start web app by loading page in website root
Navigate to page such as /Manage/ViewEmployee/1
iisreset
Reload page /Manage/ViewEmployee/1
Step 4 will always result in a 404 error. I can reproduce this consistently in my test environment:
Windows 2008 R2
IIS 7.5
ASP.NET 4.5
Microsoft ASP.NET Friendly URLs 1.0.0
I cannot reproduce this issue, however, with IIS Express on Windows 7.
Are there any web.config settings that I can add to address this with IIS 7.5?

Were you able to load the page in the first place by entering the URL in the browser? I suspect the issue to be a problem with the URL and not with the IISRESET. Since you are using the latest version of IIS, there should be no problems with the settings too for handling friendly url's.

Related

ASP.NET Website issue - will not load externally

I have a site that works fine on the server itself. I can browse to the site from within IIS or by launching a browser on the server itself. However, if I try to access this externally, I get a 404 error.
I have tested DNS for the domain in question (www.phanetworktest.com) and that is not the issue. I was able to create another site with a single, simple HTML page and the site was then accessible outside of the server. I believe it is either a configuration issue with IIS or maybe a problem with the application itself. It is an ASP.NET 4.6 application.
The error when I try to navigate to the site externally is "404 - not found".
There is a variety of other sites also running on this server, including a classic ASP site, an ASP.NET 4.6 website, and two ASP.NET MVC sites.
Any help would be greatly appreciated.

Setting up a simple website with IIS

I am trying to create an ASP.NET MVC 4 website and serve it with IIS 7.5. So, I build it in Visual Studio, and then publish the code to a directory. In IIS Manager, I create a new website, whose physical path is the publish directory. The bindings are http:*:80:.
However, when I try to reach the website by typing in the name of my machine on a browser, I get the following error message:
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
What's going on here?
Karnivaurs
Try to use "localhost" or the loop back ip "127.0.0.1" to get to the site.
For the browsing, If its available in IIS then you have to enable it. See here
I wonder if you have the same issue that happened with this question, it solved my problem with IIS on Windows 8
MVC 4 website with .NET 4.5 on IIS 8 in Windows 8 gives 403.14 forbidden error
Does it work when you run it straight from visual studio? Do you have home/index? To enable directory browsing in IIS , you need to double click on Directory Browsing and Enable it. That way you can see the content of the directory. After that, you can browse to your html page.

Precompiled .NET app receiving "Internet Explorer cannot display the webpage"

We have a web server that is running many web applications. When I took over this server, I noticed that the sites were not precompiled, so in an effort to clean it up, I precompiled the site using the Publish option in VS2008 (and allow the precompiled site to be updatable).
When I deployed the site to the web server, the site stopped working - In IE, I get "Internet Explorer cannot display the webpage" - in firefox I get "Unable to connect. Firefox can't establish a connection to the server at >>sub.domain.com<<". Here are a few things I've noticed:
I am able to manually browse to the one static .html file that is part of the site
If I replace the precompiled files on the server with uncompiled code, the site works fine
If I switch the application pool to use .NET 4.0, I get errors with duplicate system.web.extensions module, which I would expect to see with an application built for .NET 3.5.
When I initially browse to the site after a fresh IISRESET, the app redirects to /Login.aspx, which the web.config defines as the forms auth login page. It then redirects to /default.aspx and displays the error in question.
CustomErrors is OFF, debugging is ENABLED, and yet I don't get a helpful .NET error page, and I see no System or Application-level events in the Windows event log.
Any hints as to why this might be happening? I was able to successfully precompile another site on the same server with ZERO problems.
I found the problem myself. The login page was redirecting to HTTPS if the host header wasn't localhost. I noticed that in the uncompiled site, someone manually went into the .VB file for the login page and added the specific domain for the beta site into this check, preventing the redirect to HTTPS. I copied the code into my local, recompiled, and deployed, and now the site works as expected.

ASP.Net MVC2 - IIS7.5 doesn't find view file for home page

We have a mid-sized asp.net project that we just promoted from our dev server (Windows 2003) to an external test server (Windows 2008 R2).
On the test server, IIS is not finding our home page, which is located in the views/home folder (404 error). As far as we can tell, the settings are the same on both servers. I've confirmed HTTP redirection is installed.
Is there perhaps some critical configuration we may have missed on IIS7.5 to let it know where to find the view and/or home page?
What do you mean by "not finding"? Are you getting 404 error?
I had a similar situation which was related with bad install of ASP.NET on windows 7 machine, so I would recommend you to:
Check if ASP.NET is installed on server
Run aspnet_regiis to check that ASP.NET correctly registered with IIS
We changed the App Pool for 4 classic to 4, seemed to fix the 404 issue.

ASP.NET Custom Error Page Not Displayed for Abnormal URLs

A vulnerability scanning service regularly tests our site for PCI scan compliance. It has just started trying to access URLs with abnormal formatting, such as:
http://www.mydomain.com/ShoppingCart.aspx//ErrorPage.aspx%3fid%3d2?
We have a Custom Error Page set which works for everything except this. Is there any way to force IIS to display it for this type of URL?
The Error: Runtime Error - An application error occurred on the server....
We're using:
ASP.NET 2.0 (Framework 3.5)
IIS 7.0 (Windows Server Web 2008)
I've tried to debug this, but I can't reproduce this on IIS 6.0.
There might be a more simple solution, but if you're on IIS7 you can use URL Rewrite to match those type of URLs and map them back to your error page.
The %3f part isn't being parsed by IIS 7 and so it can't find the page. If you look in your site logs you'll probably see some 404's.
You'll need to configure IIS 7 to point to your errorpage.aspx file as it's default 404 page.

Resources