Datatables Editor works on local machine but not published on Azure

Datatables Editor works on local machine but not published on Azure

gjerichogjericho Posts: 3Questions: 1Answers: 0

This problem is similar to problem raised by peterjones30 Jun2018. But there was never a solution posted other than changing from SQL Azure to MySQL on Azure. Not an option for me. I followed all the advice in this posting.

I used the generator to create a demo for the editor. I changed the DBConnection to my Azure SQL database and everything works fine. I can add, update,delete entries running on localhost.

When I publish app to Azure and using same Azure SQL database, it returns:

DataTables warning: table id=Patient - Ajax error. For more information about this error, please see http://datatables.net/tn/7

and a GET 500.

Site is
https://editornetcoredemo4.azurewebsites.net

I have another app using datatables (no editor) and same Azure database that works fine when published to Azure.

Any known issues running an app published in Azure using the editor?

Answers

  • colincolin Posts: 15,146Questions: 1Answers: 2,586

    Hi @gjericho ,

    Can you look at this thread please and see if it helps - there's instructions there on what to do.

    Cheers,

    Colin

  • gjerichogjericho Posts: 3Questions: 1Answers: 0

    Hi Colin,
    Thanks for the reference. But I believe these are instructions for making datatables work with Azure Blob storage? I am trying to connect with a regular Azure SQLServer, which should function the same as a regular local SQLServer.

  • kthorngrenkthorngren Posts: 20,309Questions: 26Answers: 4,771

    Did you follow the troubleshooting steps provided in the error link?
    https://datatables.net/manual/tech-notes/7

    What did you find in your server's log regarding the 500 error?

    Kevin

  • gjerichogjericho Posts: 3Questions: 1Answers: 0

    Thanks Kevin,
    I followed the advice in tech-notes/7. But a 500 error does not give much direction, other than the server returned a 500, but no reason why.

    Anyway. After playing with all sorts of properties and logs in Azure, I went back and started from scratch with the Generator.

    Following are my steps:

    The program created by the Generator for ASP.NET Core and SQLServer.
    Runs successfully on localhost under VS 2019 connected to an Azure SQLServer database. I can read, create new, edit and delete rows. Works perfectly.

    After publishing to https://editornetcoredemo6.azurewebsites.net, get error

    Datatables warning table id=patient - Ajax error. for more information please see
    http://datatables.net/tn/7

    The chrome developer tools show a GET ...... 500 (Internal Server Error)
    Indicates there was an jquery ajax callback error.
    Network tab: Patient?_=1570415318968 Status 500 Type xhr Initiator = datatables.min.js:14 size 134 B

    I suspect that long number is some internal reference?

    Go to Azure Portal to check for App server event log.

    Connection string - Server=tcp:xxxxmyserverxx.database.windows.net.1433;Initial Catalog=NAT;Persist Security Info=False; User ID=xxxx;Password=xxxx;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
    (This connection string works from localhost)

    Activity Log shows nothing that looks like an error.

    Diagnoses and Solve Problems: Availability and Performance:
    HTTP Server Errors (indicates an application code issue. An un-handled exception in the application code or an error in application is what typically causes the error.
    (Not very helpful!!)

    FailingModule AspNetCoreMdule HttpStatus=500.0 Method GET URl /api/Patient
    (** but no indication why the GET failed)

    Also suggests running on a Production workload. Change to 'S1 Production' - no difference

    Look at SQLServer logs:

    Standard S0: tier CStatus: Online

    Tried changing firewall IP address to Azure App range - no change
    My computer's IP address has already been registered.

    Maybe I will try to create an API server to this database and use a REST interface. But this looked so simple and quick to create.

    Graham

  • allanallan Posts: 61,734Questions: 1Answers: 10,110 Site admin

    Hi Graham,

    Thanks for the extra information. 500 errors are effectively impossible to diagnose on the client-side since they just mean "something went wrong". That said, if you click on the request in your browser's network inspect, does it show anything useful?

    An un-handled exception in the application code or an error in application is what typically causes the error.

    The .NET Editor libraries should never throw an unhandled exception since they do a try/catch by default. You could try disabling that using .TryCatch(false) immediately before the .Process(...) call, but I'm not convinced that is going to be of must use in this case.

    Allan

This discussion has been closed.