Base solution for your next web application
Open Closed

Azure publish ok, but gets HTTP 500 when redirects to login #4892


User avatar
0
Mitch created

I've just tried for the last 48 hours to follow the ASP Net Zero Azure guide to get my app working in Azure, but no luck. I'm using the Core project with JQuery. I'm only trying to publish the MVC project, not the Public site.

I have had several existing web apps up and running on Azure for the last 2 years, but my attempts to get ASP Net Zero to work on Azure seem to be getting nowhere. As a last resort I went back to the beginning and used a fresh ASP Net Zero project with no modification except for the database connection strings. I decided to use a connection string that pointed to my existing Azure SQL subscription. Everything works perfectly on my local dev PC, but when I try to run the app after successfully publishing to Azure I get a HTTP ERROR 500 when it tries to redirect to /Account/Login.

I'm struggling to find out what the cause of the 500 error is. I've tried to add Application Insights but that not giving me any feedback regarding the error.

Does anyone have any clues as to what the error could be? Is the app trying to write to location that doesn't exist in the Azure environment? Could it be something to do with HTTPS?

I'm really out of ideas.


8 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    Can you show the error in Logs.txt? It should be in App_Data folder.

  • User Avatar
    0
    Mitch created

    Hi Aaron,

    It can be a bit tricky reading logs in Azure Web Apps. I decided to log into Azure, go to my App Service and in Settings => Application Settings I added a new settings to the Application Settings section. (which was ASPNETCORE_ENVIRONMENT in the first column followed by "Development" in the second column. This allows my Web App to report a detailed error message.

    The detailed error is "DirectoryNotFoundException: Could not find a part of the path 'D:\home\site\wwwroot\Plugins'."

    I'm using a new version of ASP Net Zero with jQuery release 5.3.0 (.Net Framework not Core) with only the connection strings changed. It works fine on my development PC.

    Why on earth is it looking for 'D:\home\site\wwwroot\Plugins'. !?

  • User Avatar
    0
    Mitch created

    I've actually got things working in Azure!

    In Startup.cs I commented out the following line

    options.PlugInSources.AddFolder(Path.Combine(_hostingEnvironment.ContentRootPath, "Plugins"));

    Now ASP.Net Zero will run and allow me to log in. Not sure if the commented out line will cause me issues later though.

  • User Avatar
    0
    thor created

    Had same problem.

    Merged version 5.3 into my project. Worked fine locally, but 5.3 failed with strange error code 500 when running in Azure. (Took a while to find the problem because very little useful logging were provided). I am not using Plugins (yet) so not an issue to comment out this line...

  • User Avatar
    0
    ismcagdas created
    Support Team

    @thor it should also work if you create a folder named "Plugins" on your azure website. We will take a look why this folder is not published.

  • User Avatar
    0
    thor created

    I tried to create a Folder under wwwroot already. That didn't work (it stopped complaining about the folder not existing, but still got the 500 error - but I couldn't find anything in the logs to say why).

  • User Avatar
    0
    ismcagdas created
    Support Team

    @thor I think the "Plugins" folder must be in the same level with wwwroot, not in the wwwroot folder.

  • User Avatar
    0
    tingwang created

    @Mitch

    thanks ,Your method can help us