locked
Internal Server Error - 500 using quickstart RRS feed

  • Question

  • I am completely new to Azure. I am trying to create a new Mobile app (cordova) using the quickstart using all the defaults. I am creating a new SQL database and new cordova app. I have followed the quickstart to the letter - downloaded c#backend, built it published it successfully , created a new cordova app and downloaded it. I now have the cordova app open locally in VS 2015. When I hit F5 to run the cordova app using the emulator, the app loads, but I see no data - just "internal server Error - 500", below where it says "Loading Data from Azure". Is this supposed to work "out of the box" or am I supposed to modify connection strings etc ? I was sort of hoping it would just work...

    The error happens here:

      // Execute a query for uncompleted items and process
            todoItemTable
                .where({ complete: false })     // Set up the query
                .read()                         // Read the results
                .then(createTodoItemList, handleError);

    so I guess I'm not seeing the database or the data in it.

    If I go back to the App Service project and look at the publish options, the "validate button" on the connection tab is successful. If I click  "Next" to go to the settings tab and open the connection string window "Test Connection" returns the familiar "a network-related or instance-specific error Occurred.." message, ending with "The requested name is valid, but no data of the requested type was found". Should this work or would I expect it to fail, as at this point I'm "local" but the string is for "Azure", or something (!) ? I'm a bit lost now - have I missed something obvious? What are my next troubleshooting steps? I really don't know what I'm doing , but hoped the quickstart was the place for a total noob. 


    martin

    Friday, May 13, 2016 1:37 PM

Answers

  • Since you are using Visual Studio, a better idea may be the following:

    1) Install the Cloud Explorer if you haven't already

    2) Deploy a DEBUG build of your site

    3) Attach the debugger - you can do this by going to the cloud explorer, finding your app service, right-click and "Attach Debugger"

    4) Run your client

    5) The debugger will tell you where the app is crashing, allowing you to diagnose the problem by capturing the exception and place.

    A couple of other things to check:

    1) Ensure that you have a SQL database created properly - it should be listed as a Connection String in the Application Settings for your App Service

    2) Ensure the username and password are valid for the database.

    3) Take a look at the tables - there should be one (TodoItem, with seven fields) - you may want to delete the TodoItem table from your SQL Azure instance to re-create everything.

    Wednesday, May 25, 2016 6:26 PM

All replies

  • It *should* just work out of the box, but several things can go wrong.   The "internal server error - 500" indicates that the server crashed while serving the request.  This is unusual if the database is set up properly.  However, it's a generic error, so lots of things could be going on.

    1) Go back into the portal and your app service, click on the Data Connections link and ensure that a database is actually connected.  It should be listed in the Data Connections blade. (If not, you can use the +ADD button to add it - sometimes, the connection fails to be made).

    2) Turn on diagnostic logging and see if anything is shown in the system log that might account for the failure.  You can find instructions for this in the monitoring section of the azure.com documentation.

    Let us know how you get along with this and I will try to assist further.

    Friday, May 13, 2016 8:14 PM
  • Is my issue just to do with my corporate firewall/proxy ? I repeated the quickstart on my laptop at home (not my desktop at work) and it worked first time. I just downloaded the cordova project rebuilt it twice (as per instructions) and ran it - so I am using the same back end I created at when at work.

    I had all sorts of trouble just installing the cordova VS components on my work desktop due to firewall issues, but I assumed running the mobile client would be OK as publishing my back end to the cloud worked. (cf. Kim Kardashian)
    Back on my work desktop I tried the cloud explorer in VS. I can see my database, but when I did right click, Open SQL Server Object Explorer I was prompted if I wanted to add a firewall rule to manage my cloud sql server. What IP ? What firewall ? I tried entering the external IP of my desktop, but I got "Error Failed to add the firewall rule". Not sure which firewall this is referring to or why it failed or if this is the root cause of my 500 error. On cancelling the firewall prompt I can see some cloudy databases but none named like mine. I don't know if any of this is relevant.

     

    martin


    Saturday, May 14, 2016 6:38 AM
  • If you are seeing 500, it means your request is being received by the server but is failing for some reason. Can you check the diagnostic logs as suggested by Adrian Hall?

    Monday, May 16, 2016 10:57 PM
  • I did set up the diagnostic logging, but the logs showed no connection at all from the client. That's when it occured to me that it might be bacause it was being blocked. But of course you are right - 500 errors come from the server, so I'm not sure why they are not being logged (presumably I've not set it up properly). I'll have another go later and post the logs. 

    martin

    Tuesday, May 17, 2016 7:26 AM
  • I have downloaded the logs via FTP. I now have 41MB of logs in 1,022 files in 213 folders. I had a quick look around but it is like looking for a needle in a haystack. What am I looking for in what folder/file ? (there are more than 1000 references to "500 " across 55 of the log files...

    martin

    Monday, May 23, 2016 2:10 PM
  • Since you are using Visual Studio, a better idea may be the following:

    1) Install the Cloud Explorer if you haven't already

    2) Deploy a DEBUG build of your site

    3) Attach the debugger - you can do this by going to the cloud explorer, finding your app service, right-click and "Attach Debugger"

    4) Run your client

    5) The debugger will tell you where the app is crashing, allowing you to diagnose the problem by capturing the exception and place.

    A couple of other things to check:

    1) Ensure that you have a SQL database created properly - it should be listed as a Connection String in the Application Settings for your App Service

    2) Ensure the username and password are valid for the database.

    3) Take a look at the tables - there should be one (TodoItem, with seven fields) - you may want to delete the TodoItem table from your SQL Azure instance to re-create everything.

    Wednesday, May 25, 2016 6:26 PM
  • I get "The debugger was unable to resolve the specified computer name". when trying to attach the debugger.

    I've moved on now and have a "real" Azure SQL Database that I can connect to from on premise. I think something went wrong with the creation of the quickstart (there were issues the day before). I'm going to give up on this quickstart, delete it and carry on with my real app . Thank you all for your help - it has not been wasted as I now have a vague idea about how all this stuff works.


    martin

    Tuesday, June 7, 2016 3:41 PM