locked
404 and 403 errors following App being published to IIS RRS feed

  • Question

  • User854162288 posted

    Hey All,

    I am using ASP.NET Core 3.1 React template and connecting up to a Microsoft SQL server database

    I am a beginner really when it comes to Asp and IIS. I have an issue following my publishing of the app. Whilst working in localhost everything is fine, I can perform all crud operations and update the database accordingly. However now that I have moved outside of VS to serve my app I cant retrieve any pages that require use of the database and its driving me mad. 

    I have created my website up in IIS and using no authentication apart from anonymous set to enabled. I have defined a host and virtual path and using the physical path of my app as ClientApp/build (as its a react application). I just cannot hook up to my database. 

    Does anyone have any ideas where I may be going wrong, now that I am serving my site from IIS and no longer working in localhost? I know 404 is a routing issue but the routes are what they should be, im thinking there is more to it 

    Saturday, October 31, 2020 12:00 PM

Answers

  • User1120430333 posted

    Hey just a quick one again, so ive installed the runtime hosting bundle on the IIS server. im just getting 403 forbidden every timeI try to hit a url 

     GET http://odgh-webapp-uat/masks/maskdetails 403 (Forbidden)  xhr.js:177

    From your experience what generally causes this to happen

    https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403

    It usually is a catch 22 message that your program is doing something that the Web server thinks is bad. It may be that you may have to debug the program using Visual Stuido where VS pushed the executables for your project out to local IIS on your development machine and tied you project source code in VS to the executables it deployed to local IIS. VS effectively has disconnected your program from IIS Express so that you can use VS to debug your program and possibly get the same conditions that are happening on IIS where you published the solution to, becuase VS has setup things to debug your solution out on local IIS the real Web server just like the one you published to.

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

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 2, 2020 4:38 PM

All replies

  • User1120430333 posted

    You can Install Fidler to look at the Http traffic 404 means site not found that could be due to a malformed url. You can use Network in the F12 browser developer tools to look at the HTTP traffic. 

    You can push the solution to local IIS on your development machine and used the debugger that might have exposed the errors you are getting before you did the publish.

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

    The 403 means a resource the WEB program is trying to use is forbiden . 

    Saturday, October 31, 2020 1:25 PM
  • User854162288 posted

    Hey, thank you for the response. Im thinking my issue may lie in the asp.net core runtime. If you could be so kind as to clarify my point below

    Firstly IIS is running on a different server to my local machine. I have installed Asp.Net core runtime module on my local machine but not on the server where IIS Belongs. Will this be the problem, im guessing with no runtime on the IIS server my asp app cant function?

    Do I need to install the runtime module on the server where IIS belongs?

    Sunday, November 1, 2020 9:27 AM
  • User1120430333 posted

    The Http 404 means that the url was sent to a Web program host on IIS by the Web client program,   but url never made it to the Web server program to execute. The url hit the Web server IIS reported back that it could not find a Web site on IIS with a method that matches the signature that the url specified. 

    It could be that IIS is not configured properly to host an ASP.NET Core solution. You can go to IIS administration and test that a site works or not that has been deployed to IIS. You can use IIS manager to verify that the site exist and browse to the site while in the IIS Manager, which is an option of the right-hand side of administration screen for the site info being displayed.

    If you have not installed the 'Hosting Bundle', then you will need to do it.

    https://hostadvice.com/how-to/how-to-configure-install-and-deploy-asp-net-core-to-iis/

    Sunday, November 1, 2020 10:39 AM
  • User854162288 posted

    Really appreciate your help on this thank you. I cant test this out until tomorrow but im confident this will resolve the matter. 

    It makes sense that I can see the React pages but not the ASP content if I haven't got the hosting bundle installed on the IIS server. 

    Sunday, November 1, 2020 11:56 AM
  • User854162288 posted

    Hey just a quick one again, so ive installed the runtime hosting bundle on the IIS server. im just getting 403 forbidden every timeI try to hit a url 

     GET http://odgh-webapp-uat/masks/maskdetails 403 (Forbidden)  xhr.js:177

    From your experience what generally causes this to happen

    Monday, November 2, 2020 1:58 PM
  • User1120430333 posted

    Hey just a quick one again, so ive installed the runtime hosting bundle on the IIS server. im just getting 403 forbidden every timeI try to hit a url 

     GET http://odgh-webapp-uat/masks/maskdetails 403 (Forbidden)  xhr.js:177

    From your experience what generally causes this to happen

    https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403

    It usually is a catch 22 message that your program is doing something that the Web server thinks is bad. It may be that you may have to debug the program using Visual Stuido where VS pushed the executables for your project out to local IIS on your development machine and tied you project source code in VS to the executables it deployed to local IIS. VS effectively has disconnected your program from IIS Express so that you can use VS to debug your program and possibly get the same conditions that are happening on IIS where you published the solution to, becuase VS has setup things to debug your solution out on local IIS the real Web server just like the one you published to.

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

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, November 2, 2020 4:38 PM
  • User521825913 posted

    This error indicates that the server has determined that you are not allowed access to the thing you've requested, either on purpose or due to a misconfiguration . It's probably because the site owner has limited access to it and you don't have permission to view it.  The vast majority of the time, there's not much you can do to fix things on your (*client) end. There are three common causes for 403 Forbidden error (server side) . Here they are listed from most likely to least likely:

    • An empty website directory
    • No index page
    • Incorrect settings in the .htaccess file
    • Permission / Ownership error

    If authentication credentials were provided in the request, the server considers them insufficient to grant access. The client SHOULD NOT automatically repeat the request with the same credentials. The client MAY repeat the request with new or different credentials. However, a request might be forbidden for reasons unrelated to the credentials.

    Monday, November 9, 2020 5:16 AM