IIS 6 not displaying default document (default.aspx) - asp.net

We have a problem in that IIS is no longer serving finding the default document (default.aspx) on a server which has previously been working OK. We have not consciously changed the configuration of the machine.
The symptoms are that if you go to the root of an application on the machine, it displays an asp.net 404 not found page with the following text:
The resource cannot be found.
Description: HTTP 404. [etc...]
Requested URL:
/folder/eurl.axd/dd4414e526108f45a561b782d54f3ba2/
I don't know what eurl.axd is, but it seems to refer to extensionless URL support for ASP.NET 4.0, but the sites in question are all ASP.NET 2.0 sites.
Default.aspx is definitely set as the default the document (and is at the top of the list) for the site.
If I manually type in /folder/default.aspx the site then works fine, so it's not a problem serving the page, but merely a problem with IIS not defaulting to that page on it's own.
Any ideas how to fix this would be appreciated as this affects a live server :(

OK I've resolved this now. It seems it is indeed because of the extensionless URL support feature of ASP.NET 4.0. Despite the fact my sites are running .NET 2.0 sites it still seems to affect them as well (possibly because the URL filtering happens higher up?). I disabled extensionless URL support (see link) and now it's finding default.aspx pages OK.
For for more info, check this article:
http://blogs.msdn.com/b/tmarq/archive/2010/06/18/how-to-disable-the-asp-net-v4-0-extensionless-url-feature-on-iis-6-0.aspx

To install and enable ASP.NET:
1> Click Start, and then click Control Panel.
2> Click Add or Remove Programs.
3> Click Add/Remove Windows components.
4> Double-click Application Server, and then click Details.
5> Click to select the ASP.NET check box, and then click OK.
6> Click Next.
7> Click Finish.

Related

Trouble setting up IIS for ASP

Windows 7 Ultimate
IIS7
At first I enabled all settings in IIS, the default page of IIS could be viewed but when I tried to view pages in C:\inetpub\wwwroot\MyWeb, I used to get a 404 error.
Then I tried:
ASP
ISAPI extensions
Request filtering
It didn't show me the default IIS page even. Then I tried:
ASP
ASP.NET
ISAPI Extensions
Default document
Static content
Request filtering
It showed me the default page but when I tried to view files in the directory, Chrome said that the link appears to be broken. At present my settings are:
IIS management console
.net extensibility
asp
asp.net
cgi
isapi extensions
isapi filters
server-side includes
default document
static content
request filtering
Still, I am getting the "link broken" message.
Oh, and I am using Dreamweaver CS5 and when I preview the ASP page from Dreamweaver it asks me if I would like to specify a testing server. I choose No as I am new to this and not aware of how to specify a server. Is that the problem?
This is the official site for your problem:
http://www.iis.net/learn/application-frameworks/running-classic-asp-applications-on-iis-7-and-iis-8
The first entry is probably what you need.
I recently set up ASP on IIS8 by simply installing the server features you listed first (ASP and ISAPI Extensions). Maybe you have another problem, like a wrongly setup website in IIS. You could enter a simple default.asp or maybe you should try a iisreset and check that some static file is available where you expect the asp files to work.

IIS 7 Windows Server 2008 / CSS file not loading within aspx

I've found out several topics related to this issue yet I couldn't find an answer which worked for my problem, which is following:
I moved my Asp.Net 4.0 site to a new server (IIS 7, Windows Server 2008). The server side is working fine but the CSS style sheet is not loading.
When I use firebug, I see the following on the part where css should be loaded
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Despite this message,I can display the content of the css (in text) on the web (such as ../Styles/button.css ..etc)
I have tried some solutions such as staticFile handler mapping on IIS or adding ASP roles on server manager (through control panel).
Any help would be appreciated
Kind regards
The articles/topics that you have found is talking about the same thing as Uali's answer, which is correct, but it doesn't always solve everyone's problem. The problem is also not about your css per se.
Before proceeding, make sure that you have enabled Static Content as the other answer instructed.
Then do these steps in the IIS Manager window with your virtual directory selected.
Open Handler Mappings.
Click Add Managed Handler in the Actions Panel located in the right.
In the request path field, type: *.css
In the type textbox, enter: System.Web.StaticFileHandler
In the name textbox, type in any descriptive name you want such as css fix.
Click OK.
Update:
I also forgot to say that you can do the same thing for .jpg, .png, .gif or any other file types if necessary.
Please Make sure Your IIS 'Static Content' is enabled.
Do to This follow these steps:
Open Control Panel
Click Programs
Click Turn windows features on or off in Programs and Features.
Open Internet Information services -> World Wide Web Service ->Common HTTP Features
Make sure Static Content is checked, Mark checked if it
is not.
Hopefully it will help you.
The process of enabling Static Content on Windows 7 is different from that on Windows Server 2008.
To install the Static Content feature on Windows Server 2008 and Windows Server 2008 R2, follow these steps:
a. Open Server Manager, and then expand Roles.
b. Right-click Web Server (IIS), and then click Add Role Services.
c. Under Web Server, click to select the "Static Content" check box.
d. Click Next to complete the installation.
Here is the complete step by step guide for both situation for reference.
http://support.microsoft.com/kb/2196177

asp .net 4.0 app on IIS7 Error 404.17

I am having a problem setting up a website under IIS 7. I have created an application and the application pool for the application. Application pool is using .Net Framework 4.0 as my .net app is written in .Net Framework 4.0. Application pool is set to use classic Pipeline Mode. MIME Types have been automatically added to .asp & .aspx.
When I run the website windows explorer is showing me "View Downloads" and trying to download "application name localhost" when it downloads the file I notice that its the html of my default.aspx. I have checked Default Document and it contains Default.aspx.
If I remove .asp & .aspx MIME Types then I get an error: HTTP Error 404.17 - Not Found The requested content appears to be script and will not be served by the static file handler.
I have seen this problem many times. IIS is not serving aspx pages and most likely is not running for the entire server or that site.
For the entire server: Check to see if iis world wide web service is running.
For the site alone: Hit run inside IIS.
You can easily know if IIS is running properly by going to IIS and hit the browse option from inside a web site.
With the data you have put these are the things I would try in order if I were you:
Check in Server Manager/ Features if ASP.NET is installed (ServerManager/Roles/Web Server(IIS) look for ASP.NET
Check IIS Manager if everything is ok by:
Try to browse a test.html file to see if you are able to browse normal
Check Basic settings by clicking Test Settings
Check Handler Mappings to see if aspx is there.
Try to browse a sample test.aspx page with test data.
Check Application pool settings.
Reinstall Framework 4.0
Reboot machine ( a classical)
If you gave us more info and/or the ouput of my proposed tests maybe can help more. Good Luck :)
I had the 404.17 error happening on a server today. As you and cad mentioned, I checked the framework of the Application Pool that my site was using to make sure it was set to ASP.Net 4.0, and it was. What happened in my case is that my site was not using the application pool that I thought it was. My site was nested under another site, meaning my site pointed to a subfolder but another site was pointing to the root folder. Even though I had my site set to use the ASP.Net 4.0 Application Pool, the root site used a different Pool that had ASP.Net turned off, it was set to "No managed code". When I set the framework to 4.0 for the Pool the parent site was using, then my site started working.
In my case the solution was fixing the Handler mappings as explained here: http://forums.iis.net/post/1943489.aspx
IIS Manager->high-light you web site->click Handler Mappings icon on
the home pane->click Revert to Parent...
on the right Actions pane

setting default page in asp.net app

We have a asp.net app, in which index.aspx is the default document in the website, instead of default.aspx.
Index.aspx is set as start page in the project too. but when I am trying to open for example: http://localhost:2265/, 1st I was getting the default.aspx page, after I removed the default.aspx file from the solution, now I have the directory listing displayed.
I would like to get index.aspx when I am entering http://localhost:2265/, is that possible to be set in the project or only in IIS?
Thanks in advance and happy holidays, Laziale
This is controlled from the server, which could either be IIS or the development server that's bundled with Visual Studio.
If you're launching the app from within Visual Studio, then the controls can probably be found under the properties of the ASP web site/app that you're launching. You could also right click the page itself and select "Set As Startup Page".
All of this doesn't affect the behaviour of the app once it's hosted in IIS, however. You'll need to find similar settings in the IIS page - there should be many a tutorial on the web for that (I can point you to one if you're having trouble).
Hope this clears up the behaviour of default pages!
Just open your solution in VS, then select the page you would like to be the startup page and do a right click and select 'Set As Start Page' option
In your project right click on the page you want to be your landing page and click "Set as Start Page".
This will only work when you run it from Visual Studio though. If you want to do it once it's deployed you will have to use IIS or setup a redirect I believe.

Forcing custom 404 pages for pages in URL Routing

Coding Platform ASP.NET 4.0 WebForms on IIS7.5
If I request a page blahblah.aspx which does not exist, I get navigated to my custom error page for Page not found Exception. I have implemented URL routing and so I have omitted all my .aspx extensions for routes.
Now, If I type www.mysite.com/blahblah (thats a url without extension) instead of going to my custom error page, it gets redirected to my IIS 404 error page.
What should I do to make my custom error page appear on my site instead of IIS error page?
The Easy Way
If your IIS 7 web server doesn't already have it, install the IIS 7.0 Administration Pack from Microsoft.
Navigate to the root web server name in IIS, and open the Configuration Editor (part of the Administration Pack). Change the dropdown to system.webServer/httpErrors, right-click on defaultPath, and choose 'defaultPath' Attribute -> Unlock Attribute.
Then try to change the custom error handler page again. Navigate to your site, open Error Pages under the IIS group, click Edit Feature Settings on the right, select Custom error pages and finally, put in your path for the default page.
No lock error this time.
I originally tried to unlock this attribute at the web site level but was prevented, so be aware you may have to go all the way to the root of the IIS tree, the web server itself.
The Manual Way
I know you can accomplish all this by direct editing in notepad of the appropriate config file on the web server. And that may be required for your particular web hosting environment or company production web server change protocols. But why make it complicated if it doesn't need to be? Plus, this way you can do it in the GUI, and compare the before and after to see what changes you truly have to make. But if you MUST do it manually, then:
Open the file %windir%\System32\inetsrv\config\applicationHost.config in Notepad. Run Notepad as administrator if you're having problems.
Pro tip: Do not use notepad++ to edit applicationHost.config. You'll end up secretly and silently saving a 32-bit copy of the file that's in a different folder than the one IIS looks in (due to Windows, not np++) without actually affecting the file you wish to change.
You'll see something like this:
<httpErrors lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">
Remove the ,defaultPath section and save.
You will be able to make the changes you need.
Assuming you haven't done this already...
Go to IIS, select your website, and choose the option "Error Pages". In there, find the 404 status code, right click and go to "Edit Feature Settings". you can then select "Custom Error pages" and change the "Path Type" to URL "Execute URL" to do some rewriting, or a default redirect page for anything else. Put in your URL as a relative value, and now it should redirect to this url on 404 errors.
Edit: Did a bit of digging, in cases, this config may be locked, if you run the following command, it should remove the lock:
%windir%\System32\inetsrv\appcmd unlock config -section:system.webserver/httperrors
Once that is done, you can edit the url properly.

Resources