locked
internal service error RRS feed

  • Question

  • using MS mobile apps client to attempt to write to the Users table in a database.

    Created the app service using Azure Portal.

    The app service refers to a Git repository https://github.com/durbinjw/TravelRecordAppFix

    When the mobile app is executed under Visual Studio, it returns Internal Server Error when attempting to write a Users table record.

    

    I don't know how to debug this.  The server side code was all generated through the portal.  Is there a debug setting that will create a detail log file to determine what is wrong? 

    The mobile app is a Xamarin tutorial app written in Visual Studio 2019.  It references the Microsoft.WindowsAzure.MobileServices package to create a client object that references the Azure database. 

            public static MobileServiceClient client
                = new MobileServiceClient("https://travelrecordappjwd.azurewebsites.net");

    This is the code that returns the error

                    // We can register the user
                    Users user = new Users
                    {
                        Email = EmailEntry.Text,
                        Password = PasswwordEntry.Text
                    };

                    await App.client.GetTable<Users>().InsertAsync(user);
                    DisplayAlert("Inserted ", EmailEntry.Text, "Ok");
                    }
                    catch (Exception ex)
                    {
                        DisplayAlert("Error", ex.Message, "Ok");
                    }




    Thursday, February 27, 2020 8:13 PM

All replies

  • Hi Durbinjw,

    I didn't see TravelRecordAppFix listed as a repo but I did find TravelRecordAppBackend. Are you following a MicrosoftDocs tutorial by chance? This is a common one: Create a Xamarin.Android App

    The usual cause for the issue is that the Mobile App Service IP address is not added to the Azure SQL Server database instance, to allow connections. In your cause though, you say the user can be added so it appears that connectivity can be established with the back-end. Is it Azure Storage Tables or Azure SQL Database?

    If you have a tutorial link you can share, I can step through this see what is going on.

    Regards,

    Mike

    Saturday, February 29, 2020 1:53 AM
  • Hello Mike,

    Your first observation about not seeing TravelRecordAppjwd was surprising.  Maybe I need to do something with Git to upload my copy of that repo.  I am just getting used to Git through the portal so I could easily be missing something.

    I am intending to use an SQL database, not Azure storage tables.  When adding the database, I know there is a selection for the package.  I may have added an MS SQL database instead of an MS Azure SQL database package.  Would that make a difference?

    Finally I am working with the Udemy "The Complete Xamarin Developer Course: iOS And Android" tutorial taught by Eduardo Rosas (look him up with Google.  The course is listed).  I started off with an inadequate system that was short on memory and upgraded to a new 12 GB Lenovo Laptop.  The old machine did not support HAXM and could not run the emulator.  After that was fixed I was able to proceed through the course until It actually tried to write to the Azure database Users table.  I have not been able to successfully write to the Azure database yet due to the connectivity issue.  I can however see the database with its tables through the Azure Portal, and I can connect to the database and see the tables using SMS.  The section of the course that I am having trouble with is session numbers 84 through 88. 

    I have been able to write and read from an SQLite table as part of the mobile app.  

    Maybe I need to authorize my development system IP for access to the server with the Portal.

    Are there any screenshots of the Portal screens that would help you to help me?

    Thank you for your hints.  I will be testing them further tomorrow morning.  

    Jim Durbin

    Jim Durbin

    Saturday, February 29, 2020 6:04 AM
  • Hi again Mike,

    The course URL is 

    https://www.udemy.com/course/complete-xamarin-developer-course-ios-and-android/learn/lecture/8437868#content

    I do not know if you will be able to access it using this link.

    Jim Durbin



    Jim Durbin

    Saturday, February 29, 2020 6:08 AM
  • Hello Mike,

    This may be a duplicate message.  I added a reply with screenshots and do not see them after a refresh of the thread this morning.

    After careful review of the Portal settings and ensuring that everything looked right, the same symptom is still appearing:

       "The request could not be completed. (Internal Server Error)

    I am going to unclude 10 screenshots.  5 in this message and 5 in the next.  The will show the details that I am seeing in the portal.  One thing that does not show up is that the Sync function seemed to work ok, although amessage only flashed by briefly.  No permanent message was left on the deployment screen.

    What am I missing?  I can't continue with the Xamarin course without being able to access the database through the TravelRecordAppjwd app.  And obviously could not continue with my own application development.

    Here are the first five screen shots

    TRA 001 - TravelRecordApp Overview.png

    TRA 002 - TravelRecordAppjwd Deployment Center.png

    TRA 003 - TravelRecordAppFix repository.png

    TRA 004 - TravelRecordAppFix server.js.png

    TRA 005 - TravelRecordAppFix tables.png


    Jim Durbin

    Monday, March 2, 2020 2:57 PM
  • Here are the last five screen shots

    TRA 006 - TravelRecordAppjwd Configuration.png

    TRA 007 - TravelRecordAppjwd connection string.png

    TRA 008 - MyStuffXamarin server.png

    TRA 009 - MyStuffXamarin Firewall.png

    TRA 010 - TravelRecords database.png

    I should say that I can use SMS to access the MystuffXamarin server and examine the tables in the TravelRecords database.  That tells me that raw access to the server and database can be done from this machine, and that the issue has to be someplace in the portal configuration for the TravelRecordsAppjwd app.


    Jim Durbin

    Monday, March 2, 2020 3:14 PM
  • Hi Jim,

    Thank you for all the detailed information. I t really helps. As for the URL (https://github.com/durbinjw/TravelRecordAppFix) I receive a 404 when I attempt to navigate to that address. So, it might not be public. No worries.

    In looking at the database access issue, when you use SSMS to connect, are you connecting with an SQL Authentication credential or an Azure AD credential? In the App Service configuration can you change your connection string to use: user=mystuffjwd (dropping @mystuffxamarin).

    ~Mike

    Monday, March 2, 2020 6:59 PM
  • Hi Mike,

    The user= change did not help.

    The puzzle for me is that the mobile android app running in Visual Studio and using the Microsoft.Azure.Mobile package cannot communicate with the Web app running on the portal.  The code in the VS app only defines the client and executes the client.insert method.  It uses the URL for the TravelRecordAppjwd copied from the deployment page the portal.  The insert call is what is failing with the internal server error message.  That message gives me no clue for solving the problem.

    We both know that the database is present and can be accessed through SSMS.  It makes me think something is missing in the setup in the portal.  My guess is this will be a simple fix once we figure out what is wrong.

    I expect the standard ms mobile package to be able to communicate with the standard Web app on the server.  I can see  the the TravelRecordAppjwd has the correct table definitions and the CRUD in the table js code is present.  The code in the mobile app was copied into the first message in the thread.  

    Could it be that it is necessary to do something further with the repository definition through the portal.  The repository is in durbinjw\TravelRecordAppjwd.  I have clicked the Sync button in the Deployment tab after ensuring that all of the settings looked correct.  Does the repository need to be pulled to the server?  Is ths possibly a permissions issue?

    Jim Durbin

    Wednesday, March 4, 2020 3:33 PM
  • Hi Jim,

    I attempted to access the Udemy course but I don't have immediate access to that content (link for reference: https://www.udemy.com/course/complete-xamarin-developer-course-ios-and-android/learn/lecture/8437868#content)

    Here is what I am in the process of doing.

    Create a Xamarin.Android App and there is also a Create an iOS app option but, essentialy they accomplsih the same by configuring an App Service instance and then you publish a server compnent to the App Service instance followed by running emulated client. It might be helpful to run through this tutorial to see all the steps and then apply those steps to your specific code base.

    All the source code can be found here: Azure Mobile App Quick Starts

    Please note there is both a Server and Client project, and you must build each. There is a Troubleshooting section for the Android Quick Start. 

    Thursday, March 5, 2020 12:50 AM
  • Just wanted to show that I was able to complete the Quickstart and ensure data entered into the emulator can be queried in the database.

    Adding ToDo items to the emulator interface.

    Verifying that the data has made it to the database:

    Thursday, March 5, 2020 1:56 AM
  • Hi Mike,

    Sorry for the delay.  I am having to deal with a renter who has not paid the rent.  I have some demands on my time that are preventing full attention to this issue.

    I opened the quickstart project in Visual Studio and took a quick look.  It has code that is very similar to the Udemy course.  That section of their course is optional, and although I did listen to it, I do not remember a specific step that required an upload to the server. 

    Does the backend project need to be uploaded to the server?

    I have been expecting that configuring the app through the portal resulted in the backend app to be compiled and already waiting for an sql request from the mobile app.  Is that wrong? 

    I have not started the tutorial that you recommended yet and may not get to it until later today or tomorrow.

    Jim


    Jim Durbin

    Friday, March 6, 2020 4:46 PM
  • Hi Jim,

    Yes, you need to create/publish a server side project. You could write directly to a database but a modern architecture would use a 3 tier architecture (mobile client -> App Server -> Database). You can introduce off-line capability (included in the tutorial I provided) by enabling a set of sync tables. There is a specific configuration setting used in the Azure App Service that determines whether the app instance is mobile specific:

    MobileAppsManagement_EXTENSION_VERSION = latest

    You also set a Connection String for the database instance (see screen capture):

    The 'backend' code base is published to Azure via Visual Studio without any modifications. You might need to update NuGet packages for the client code. The client simply needs the URL for the App Service instance. The App Service configuration manages the connectivity to the database. You will need VS 2017 or VS 2015 to run the client emulator. 

    When you have a moment to breathe, this tutorial shouldn't take more than 60-90 mins. The Android version defaults to 7.1 and I choose to upgrade to 8.1 and that took awhile to upgrade the emulator environment. I also upgraded all the Android NuGet packages to the latest. This may not be the case with iOS

    Please feel free to continue to ask questions. I am here to help.

    Regards,

    Mike

    Friday, March 6, 2020 9:20 PM
  • Hello Mike,

    Here is the configuration screen from the Portal which I believe is my equivalent to your last screen shot.  I added the WEBSITE_NODE_DEFAULT_VERSION and arbitrarily set its value to 1.0.0.  After making the change, I clicked the Save button and a message appeared that said the web app was being updated.

    The same problem is appearing.

    Isn't configuring the TravelRecordAppjwd app in the portal the same as generating a backend app with VS on this machine and then deploying it to the server?  I think that is what your example is doing.

    Is there a step still missing?

    Jim


    Jim Durbin

    Sunday, March 8, 2020 6:40 AM
  • Hello Mike,

    Which tutorial are you speaking about?  I don't see a link for a tutorial in any of the messages.  There is a link for the sample program and I did download that.

    Jim


    Jim Durbin

    Monday, March 9, 2020 3:58 PM
  • Here is the tutorial information:

    Create a Xamarin.Android App and there is also a Create an iOS app option but, essentialy they accomplsih the same by configuring an App Service instance and then you publish a server compnent to the App Service instance followed by running emulated client. It might be helpful to run through this tutorial to see all the steps and then apply those steps to your specific code base.

    All the source code can be found here: Azure Mobile App Quick Starts

    Regards,

    Mike

    Monday, March 9, 2020 5:06 PM
  • Hi MIke,

    I drilled down into the Xamarin.Android.App.

    In the steps for creating the backend app in the 

    Create an Azure Mobile App backend

    step 7 says Choose the default Publish option as Code.

    Is there a way to tell what my TravelRecordsAppjwd Publish option is set to?  Can it be changed?

    Also, what does the Sync button on the Deployment screen do?  I have clicked that button and it appears to be performing a recompilation of the backend based on the repository contents.

    Jim Durbin


    Jim Durbin

    Wednesday, March 11, 2020 4:11 PM
  • Hello again Mike,

    Hi again Mike,

    I have gone through that tutorial.  The result is still the same.

    I deleted TravelRecordAppjwd and created a new one app called TRAppjwd.

    I believe I should be able to use the portal to set up the back end app.

    I believe that the portal back end should be able to communicate with the standard mobile client.

    I believe that there should be some way to see what is causing the internal error.  There should be an internal operations log.  "Internal server error" message is inadequate to work with.

    The TRAppjwd app is configured to use ASP 4.7.  Is that the correct back end configuration for use with the standard MS mobile client?

    This is taking way too long to debug.  My initial post was on 2/27.  I need to get this moving.  Maybe there is a way it can be escalated.  If it can't be resolved soon, I may have to try another web service.  Big pain ...

    Maybe an on line session with someone would help.  I think I am following the directions, but obviously I am still missing something.

    Jim Durbin

     


    Jim Durbin

    Friday, March 13, 2020 10:01 PM
  • Hi Jim,

    One immediate step that can be take is to post this to the Azure Mobile Apps forum, where there is a community audience that can better address this issue. There is also Stack Overflow.

    As a reference, the server-side SDKs can be found here for dot net: azure-mobile-apps-net-server and corresponding client-side dot net SDKs can be found here: azure-mobile-apps-net-client

    Although the symptom is connectivity to the database, the cause is somewhere with the App Service configuration or the code base you are working with. If you enable App Insights you will bea ble to troubleshhot this.

    I realize that you are wanting to implement your specific example and in looking at your GitHub repository, I do not see the client code base. I see the server code base, and it appears to be JavaScript project. You may want to cosider running a Node App Service back-end. 

    azure-mobile-apps-node (Node Server SDK)

    All Azure App Service Mobile SDKs 

    Since your project was forked from the following user's repository Glareone, I am going to look there and walk through depoying the soution, and will update this thread. In the meantime, I am moving this discussion to a more appropriate forum that has an audience who can support you more effectively. 

    Friday, March 13, 2020 11:27 PM
  • I found the GitHub repository you should be working with: TravelRecordApp

    It includes the server code base and a code base option for either Android or iOS mobile client. Let me step through this to see if it is functional.

    Regards,

    Mike

    Update: This is the specific code base used for: LPA Travel Record App source code for Udemy course on Xamarin 


    Friday, March 13, 2020 11:41 PM
  • Hi Mike,

    Before I start, I should say that I received a notice that the free account terminates in 7 days.  I have not been able to get to first base so far.  What are the implications?  Will my account be disabled?

    Below is the repository that TRAppJwd back end is pointing to.  It was cloned from TravelRecordApp following instructions in the Udemy course.  It is implemented with js and json code.   All of the backend code was exclusively developed through the browser on the portal following the Udemy course instructions.

    Is there something wrong with that? 

    Thinking back to the development, it was configured for ASP 4.7. 

    Is that correct for use with .js and .json code?

    The client side code has been developed as a project on this development system.  It has never been uploaded to Git so you won't see that code.   I have been manually entering the code as I followed the Udemy course to ensure that it all compiled correctly on this machine and that I had visited the code at least once.  The client side code was shown in the initial message in this thread.  Very Vanilla.

    Jim Durbin



    Jim Durbin

    Sunday, March 15, 2020 12:51 AM
  • Hi Jim,

    In looking at the coarse details, ASP 4.7 would be applicable but the subject matter is about learning to work with portable code. 

    Specific to your issue of not being able to connect with the database, this specific codebase used SQLite which has a local database on the mobile device (for offline processing) as well as connectivity with the database for online processing. 

    It sounds like you are using a Mac? If so, can you please install Azure Data Studio and use the connection string details for your Azure SQL Database instance to see if you can connect to the database. This is a means to test connectivity from your laptop to the database. You may need to add your Public IP to the firewall to be able to connect.

    As for your free trial, you can switch to pay-as-you-go but ensure you are using the free tier for Azure App Service and Azure SQL Database.

    I was on the phone today with Udemy to see about support for the course and you should be able to contact the instructor for assistance. I can assist you with the connectivity part of the equation but any questions about the course the instructor should be able to assist you.

    Regards,

    Mike

    Monday, March 16, 2020 7:20 PM
  • Hi Mike,

    I am developing on a Lenovo IdeaPad S340 running Windows 10 and Visual Studio - latest version.  I do not have a Mac at present.  There are a couple of Ipads in the house for eventual testing with Ios but that is for after I get the app running on the Android, and I am using the Android emulator for testing which seems to be working well.

    Yes the app will have SQLite for off line storage.  But it will also use an Azure host.  The course is is intended to teach Xamarin.  In the process it is using a lot of portable code.

    My own project could be a major application hosted on Azure.  The studies I have done show potentially millions of users with a very low end user cost.  Unless my research is defective, there is nothing comparable to what I am planning.  I have the application running on Windows in Visual Basic and SQLite and this effort is to port it to Xamarin so it will run on the other platforms.  I will still have to build a distribution and maintenance web site but do not want to do that until the application is running on all three platforms.  I already have the domain name reserved for 10 years.  I am very anxious to get this up and running.  This should be a good money maker for me and my family and for Azure.

    The Udemy training course and your training course have helped but I still need to get through this back end processing.  I am pretty sure that the portal generated backend receives and executes the CRUD requests from the client.  I suspect my difficulty still is a matter of configuring the back end correctly.

    I also contacted Udemy about support.  They will only forward a message to the author of the course.  I have requested help from Eduardo Rosas twice and have had no response so far.

    My next step is to again repeat section 82 through 88 of the Udemy course to see if I missed something in portal set up.

    Thanks for the answer about the site costs.  At least I will be able to continue working on this.

    Jim Durbin



    Jim Durbin

    Tuesday, March 17, 2020 6:23 PM
  • I would be happy to work with you on the phone, to explain a few things about database access as I support databases. I am not an Azure App Service engineer but, I did purchase the course because it was $10. 

    Please let me know what is the best way to connect. I can be reached via email at AzCommunity. Let me know if you have a web conferencing bridge or we could connect via phone.

    Regards,

    Mike

    Tuesday, March 17, 2020 6:38 PM
  • Hi Jim,

    I want to follow-up with you to see if you have any additional questions or if you have been successful with your project? Given the current Covid-19 pandemic, there are some challenges for customer's using free services. It mostly applies to attempting to deploy new services and since your solution is already deployed, you shouldn't have an issue but did want to follow-up with you.

    Please let me know if you resolved your issue, as that information is helpful to other customers who are following the same Udemy course.

    Regards,

    Mike

    Tuesday, March 31, 2020 5:23 PM