Server Error in '/' Application - The resource cannot be found. [Answered]RSS

13 replies

Last post Sep 30, 2011 08:26 AM by atripathy1

  • Server Error in '/' Application - The resource cannot be found.

    Sep 07, 2009 05:57 AM|simonalexander2005|LINK

    Hey Guys,

    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
    #Version: 1.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)

    Any thoughts?

     

    Cheers,

    Simon

    <><~~><>

     

    (note: <------- and -------> show the start and end of copied text, for clarity)

    404 iis 6 iis 404 error .NET .NET 2.0 web application dotnet 2.0 resource cannot be found server error C#

  • Re: Server Error in '/' Application - The resource cannot be found.

    Sep 07, 2009 09:18 PM|jeff@zina.com|LINK

    Permissions?

    Jeff

    Have you Binged a solution before posting?
  • Re: Server Error in '/' Application - The resource cannot be found.

    Sep 07, 2009 11:19 PM|Paul Lynch|LINK

    Hi,

    Is there definitely a file called 'Home.aspx' in the root of your site ? A 404 is a pretty clear Not Found error message.

    Regards,

    Paul Lynch
    MCSE
  • Re: Server Error in '/' Application - The resource cannot be found.

    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!!!!!

  • Re: Server Error in '/' Application - The resource cannot be found.

    Sep 08, 2009 08:44 AM|jeff@zina.com|LINK

    simonalexander2005

    gave up and gave "Everyone" full access to my entire C drive!!!!!

    First stop:

    http://weaselfire.wordpress.com/2009/07/09/everyone-isnt-everyone/

    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?

    Jeff

    Have you Binged a solution before posting?
  • Re: Server Error in '/' Application - The resource cannot be found.

    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?

  • Re: Server Error in '/' Application - The resource cannot be found.

    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.

  • Re: Server Error in '/' Application - The resource cannot be found.

    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.

  • Re: Server Error in '/' Application - The resource cannot be found.

    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.

    simonalexander2005

    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.

    simonalexander2005

    GET /Home.aspx ... 404 0 

    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 ~.

     

    Tom Kaminski (former IIS MVP 2002-2010)
    http://mvp.support.microsoft.com/
  • Re: Server Error in '/' Application - The resource cannot be found.

    Nov 19, 2009 04:07 PM|tomkmvp|LINK

    gbloomfield

    My application doesn't seem to have a base link in IIS7.

    We're in the IIS 5/6 forum ... : )

    gbloomfield

    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)

    Tom Kaminski (former IIS MVP 2002-2010)
    http://mvp.support.microsoft.com/
  • Re: Server Error in '/' Application - The resource cannot be found.

    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.

  • Re: Server Error in '/' Application - The resource cannot be found.

    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.

     

    Simon

  • Re: Server Error in '/' Application - The resource cannot be found.

    Jul 13, 2011 04:01 AM|ralphy|LINK

    Hi Guys, am also experiencing the same problem and I came across something that, though it didn't help me, might help you: Remove the app_offline.htm file from the root directory. http://geekswithblogs.net/vivek/archive/2008/07/12/123748.aspx
  • Re: Server Error in '/' Application - The resource cannot be found.

    Sep 30, 2011 08:26 AM|atripathy1|LINK

    I tried something different based on the following information.

     

    1. Check to see if you have received the following update? http://support.microsoft.com/kb/894670 If you have you might want to follow this procedure and see if it works for you. It worked partially for me.
    2. The item where it mentions the additional "/" to be removed is not entirely true but it did give me some insight to change my project properties just a bit.
    3. Right click on your properties for your Web Project in your Solun.
    4. Select WEB > Choose Current Page instead of Specific Page.
    5. Go into your project where you keep your *.aspx's select a start page. (Should be the same as the current page or choose another one of your choice :) )
    6. Hit Debug Run.

     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!

     Regards

    ATripathy