locked
404 page not found after deploying to my DEV box IIS RRS feed

  • Question

  • User1868852945 posted

    After deploying my web application to IIS on my DEV machine, I get 404 page not found with error below.

    I created the website in IIS with defaultAppPool and physical path C:\Test1\webApp\Test1

    It looks like MVC routing should work fine as it does work fine in my Visual Studio 2019.

    Can someone advise how to resolve this?  I have spent days trying many combinations and have proved that all files are where they should be. Thanks.

    HTTP Error 404.0 - Not Found

    The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

    Detailed Error Information:

    Module    IIS Web Core
    Notification    MapRequestHandler
    Handler    StaticFile
    Error Code    0x80070002
    Requested URL    http://localhost:80/Test1Login/Login
    Physical Path    C:\Test1\webApp\Test1\Test1Login\Login
    Logon Method    Anonymous
    Logon User    Anonymous
    Wednesday, July 17, 2019 4:13 PM

Answers

All replies

  • User-474980206 posted

    it looks like your site is only using the static file handler. did you follow this instructions:

       https://docs.microsoft.com/en-us/iis/application-frameworks/scenario-build-an-aspnet-website-on-iis/configure-an-asp-net-website-on-iis

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 17, 2019 5:06 PM
  • User1120430333 posted

    Do you know you can do this instead of using IIS Express, just connect the project to local IIS for testing and debugging? 

    https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-enable-debugging-for-aspnet-applications?view=vs-2017

    Also, a 404 could mean that a DLL is missing too that was not in the deployment.

    Wednesday, July 17, 2019 5:28 PM
  • User475983607 posted

    Most likely the default web site is using port 80 and your application is not deployed to the default web site.  Therefore, a URL formatted as Controller/Action causes a 404 because it does not exist.

     http://localhost:80/Test1Login/Login

    I'm guessing you configured a sub application within the DefaultSite.  The URL is similar to the following.

     http://localhost/SiteName/Test1Login/Login

    Wednesday, July 17, 2019 6:29 PM
  • User475983607 posted

    DA924

    Do you know you can do this instead of using IIS Express, just connect the project to local IIS for testing and debugging? 

    The OP is having trouble deploying to local IIS.

    DA924

    Also, a 404 could mean that a DLL is missing too that was not in the deployment.

    A missing DLL does not cause a 404.  A missing DLL causes an unable to load error message.

    Wednesday, July 17, 2019 6:31 PM
  • User1120430333 posted

    DA924

    Do you know you can do this instead of using IIS Express, just connect the project to local IIS for testing and debugging? 

    The OP is having trouble deploying to local IIS.

    DA924

    Also, a 404 could mean that a DLL is missing too that was not in the deployment.

    A missing DLL does not cause a 404.  A missing DLL causes an unable to load error message.

    About that 404, you  have not experienced that the 404 can be about something else, like a DLL not found, becuase I got the 404 error that was suppressing the file not found exception for a DLL that was not there. All that was being tossed out was the 404 when I knew that it shouldn't have been tossing it out, which for me the 404 became a 'catch 22' that could mean that it could be more than it couldn't find a Web method based on signature.

    I caught a glimpse of the exception before the 404 was tossed out while still in development and using local  IIS.

    The OP shouldn't have had to deploy to local IIS for debugging and testing the solution coming off of IIS Express, when the OP could have just had the VS Web project pushed to local IIS and not needed to do a deployment, if the OP's purpose was just to test the project out on local IIS.

    I use local IIS out the gate and seldom do I use IIS Express, in my personal usage..  I have never used IIS Express or the Web development server in VS  prior to IIS Express not in any professional environment. It is always match the environment in development one was eventually going to have the Web solution deployed to.  

    Wednesday, July 17, 2019 9:15 PM
  • User1520731567 posted

    Hi gunderj,

    Keep in mind don't forget site name if you have set.

    Error 404 on an MVC application indicates the IIS App is not configured correctly.

    This assumes the all the necessary files have been moved. ie the bin folder exists.

    Try to replace the absolute path with a relative path

    Anyway, see the deployment docs for troubleshooting steps:

    https://docs.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/deploying-to-iis

    Best Regards.

    Yuki Tao

    Thursday, July 18, 2019 6:30 AM