IIS 5 & IIS 6
Server Error in '/' Application - The resource cannot be found.
Last post Sep 30, 2011 08:26 AM by atripathy1
Sep 07, 2009 05:57 AM|simonalexander2005|LINK
I know this is a really common error, and you must be bored of troubleshooting it by now! But here's the situation I have:
I created an "Asp.Net Web application" for .Net 2.0 using visual studio 2008. I then set up IIS on my local machine (XP SP2), and it runs the website fine.
Once I copy the files over to a folder on another machine (running windows server 2003), and set it up with identical settings, I get the 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: /Home.aspx
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
The strange thing is, Default.aspx is my home page, which sets some variables, then redirects to Home.aspx (using Response.Redirect("~/Home.aspx");) without displaying anything to the user. This implies that IIS is finding Default.aspx, then failing to
use the redirect.
I have tried other solutions I have come across on the internet, including checking for a trailing / in the local path setting, and ensuring web extensions are enabled.
The log file shows this:
#Software: Microsoft Internet Information Services 6.0
#Date: 2009-09-07 09:43:18
#Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
2009-09-07 09:43:18 W3SVC632226371 NSL111 127.0.0.1 GET /Home.aspx - 80 - 127.0.0.1 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.2;+SV1;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.04506.648;+.NET+CLR+3.5.21022) ASP.NET_SessionId=j3whkn45bkiowu45zxfmnguz
- localhost 404 0 0 3694 351 15
2009-09-07 09:43:21 W3SVC632226371 NSL111 127.0.0.1 GET /Default.aspx - 80 - 127.0.0.1 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.2;+SV1;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.04506.648;+.NET+CLR+3.5.21022) ASP.NET_SessionId=j3whkn45bkiowu45zxfmnguz
- localhost 302 0 0 372 588 0
2009-09-07 09:43:21 W3SVC632226371 NSL111 127.0.0.1 GET /Home.aspx - 80 - 127.0.0.1 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.2;+SV1;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.04506.648;+.NET+CLR+3.5.21022) ASP.NET_SessionId=j3whkn45bkiowu45zxfmnguz
- localhost 404 0 0 3694 597 0
Which implies to me that it finds Default.aspx successfully (code 302), but not /Home.aspx (404)
(note: <------- and -------> show the start and end of copied text, for clarity)
resource cannot be found
Sep 07, 2009 09:18 PMemail@example.com|LINK
Sep 07, 2009 11:19 PM|Paul Lynch|LINK
Is there definitely a file called 'Home.aspx' in the root of your site ? A 404 is a pretty clear Not Found error message.
Sep 08, 2009 08:34 AM|simonalexander2005|LINK
Yeah, the file is definitely there. I have set up the permissions identically to as on my own machine (allowing for the machine name being different, etc) - and even gave up and gave "Everyone" full access to my entire C drive!!!!!
Sep 08, 2009 08:44 AMfirstname.lastname@example.org|LINK
gave up and gave "Everyone" full access to my entire C drive!!!!!
Is your machine exactly identical to the server? Same OS, same accounts, same domain membership, etc.? If not, why assume that identical settings would work on non-indetical systems?
Sep 09, 2009 04:19 AM|simonalexander2005|LINK
No I know they are different, and so that is not the case, but it was a good starting point. Obviously I adjusted the settings for, for example, the iis and internet user accounts to be what they should be for the server, and included accounts that are not
included in "Everyone" as separate entries.
From what I can see, it is the relative links that are causing the error - is "~/..." the correct syntax?
Nov 19, 2009 03:01 PM|gbloomfield|LINK
Did you find a solution to this issue with relaitve links? I'm having similar trouble. My application doesn't seem to have a base link in IIS7. Any links like "/images/myimage.jpg" end up going to the site's root directory, instead of my application's.
Like you it works fin in XP Pro sp2 and mine works with my web hosting company.
Nov 19, 2009 03:41 PM|simonalexander2005|LINK
Nothing yet - the project's kinda been put to one side for a while. I am thinking it may be the settings when I exported from visual studio though - will have to look into it.
Nov 19, 2009 04:05 PM|tomkmvp|LINK
What's interesting is that it's ASP.NET and not IIS that is reporting the 404.
Server Error in '/' Application
Furthermore, the IIS log indicates a sub-status of "0" for the 404, meaning it really can't find the file.
GET /Home.aspx ...
Can you browse to http://yourserver/home.aspx? Why bother with a redirect from default.aspx? Just set home.aspx as default document in IIS.
You could also try just Response.Redirect("/Home.aspx") - without the ~.
Nov 19, 2009 04:07 PM|tomkmvp|LINK
My application doesn't seem to have a base link in IIS7.
We're in the IIS 5/6 forum ... : )
Any links like "/images/myimage.jpg" end up going to the site's root directory
That's what I would expect, given that you preface "images" with "/", meaning the root of the site. (I do admit thought I am not familiar with what you mean by a base link in IIS 7)
Nov 19, 2009 04:52 PM|gbloomfield|LINK
Hmm you're right. If I use the Visual Studio web server the links with "/" work but on my local IIS the "/" also takes me back to the web root not my application root. My bad. Back to the drawing board.
Right now I have ASPX files at the root of the application and also in a sub folder. I want to use the same master page with both and it appears I'll have to scrap that as the links to the image folder are different for the ASPX files in the root versus
the ones in the sub folder.
Nov 20, 2009 11:58 AM|simonalexander2005|LINK
The redirect is there because some variables are set on default.aspx that only need to be set once, whereas the home page may be accessed multiple times.
Attempting to access http://yourserver/home.aspx also gives the error.
Jul 13, 2011 04:01 AM|ralphy|LINK
Sep 30, 2011 08:26 AM|atripathy1|LINK
I tried something different based on the following information.
I was able to solve my problem by using the steps as mentioned above, it might work for you or it might not. Give it a shot!