locked
Getting Internal server error on some routes after publish RRS feed

  • Question

  • User-1402320670 posted

    I use asp.net core 2.2 and make a web application

    my application working fine on Localhost, but after publish and upload on my server getting Internal Server Error when I want to access areas route.

    I get the following error:

    System.InvalidOperationException: The view 'Login' was not found. The following locations were searched:
    /Areas/Admin/Views/Account/Login.cshtml
    /Areas/Admin/Views/Shared/Login.cshtml
    /Views/Shared/Login.cshtml
    /Pages/Shared/Login.cshtml

    but Login.cshtml exist in /Areas/Admin/Views/Account/

    Saturday, October 26, 2019 7:59 AM

All replies

  • User1120430333 posted

    Do you have Global Exception Handling and logging in the solution, becuase without that, you're just stabbing in the dark?

    https://scottsauber.com/2017/04/03/adding-global-error-handling-and-logging-in-asp-net-core/

    Saturday, October 26, 2019 11:08 AM
  • User-1402320670 posted

    thanks for your answer, <g class="gr_ gr_54 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" id="54" data-gr-id="54">i</g> add global error handling and get this error:

    System.InvalidOperationException: The view 'Login' was not found. The following locations were searched:
    /Areas/Admin/Views/Account/Login.cshtml
    /Areas/Admin/Views/Shared/Login.cshtml
    /Views/Shared/Login.cshtml
    /Pages/Shared/Login.cshtml

    but /Areas/Admin/Views/Account/Login.cshtml is exist in my project !

    Saturday, October 26, 2019 11:29 AM
  • User475983607 posted

    I recommend reading the "Areas in ASP.NET Core" reference documentation and make sure you are using proper constructs.

    Shared your project if you need the community to review your code.

    Saturday, October 26, 2019 11:38 AM
  • User-1402320670 posted

    Yes, I Create Login view, Login.cshtml exist in

    /Areas/Admin/Views/Account/
    Saturday, October 26, 2019 11:51 AM
  • User475983607 posted

    I cannot reproduce this issue when following the openly published documentation linked in my previous post.  Perhaps remove the route attribute as documentation explains that areas uses global route table.

    Again, share your entire project if you want the community to review your code.  The community need enough code to reproduce this issue.

    Saturday, October 26, 2019 12:15 PM
  • User-1402320670 posted

    my project <g class="gr_ gr_24 gr-alert gr_gramm gr_inline_cards gr_run_anim Style multiReplace" id="24" data-gr-id="24">link ,</g> anything working fine on localhost! but after publish and upload can't access to area.

    Saturday, October 26, 2019 12:35 PM
  • User475983607 posted

    bahadori.embi

    my project link , anything working fine on localhost! but after publish and upload can't access to area.

    What is the actual error?  Have you tried reading the deployment troubleshooting guide?

    https://docs.microsoft.com/en-us/aspnet/core/test/troubleshoot-azure-iis?view=aspnetcore-3.0

    Saturday, October 26, 2019 3:00 PM
  • User-1402320670 posted

    I updated the thread, please read again :)

    Saturday, October 26, 2019 3:57 PM
  • User-1764593085 posted

    I download your project and publish to IIS , it works well when I open url  `/Admin/Account/Login`...

    How do you publish your project?Do you set correct  physical path to your full publish directory?

    Thursday, October 31, 2019 7:11 AM