Answered by:
Internal server error 500 (Azure)

Question
-
I get an Internal server error httpstatus: 500 on Azure (and not on my computer) but I am not able to understand or track it.
I have enabled the detailed error messages and have this kind of error
ModuleName ManagedPipelineHandler Notification EXECUTE_REQUEST_HANDLER HttpStatus 500 HttpReason InternalServerError HttpSubStatus 0 ErrorCode The operation completed successfully. (0x0) ConfigExceptionInfo
Any idea?
Thanks, Yves
Yves Pflieger
Tuesday, March 17, 2015 10:09 AM
Answers
-
Your idea of implementing some of the intensive code for filling the database with ADO.NET was a very good idea. It is very very fast compared to the Lightswitch SaveChanges method and, now, I do not have any Internal Server error any more.
Thanks for the hint!
Yves Pflieger
- Marked as answer by Yves Pflieger Thursday, March 26, 2015 8:56 AM
Thursday, March 26, 2015 8:56 AM
All replies
-
i had this issue before ,just make sure your application has correct connection string to your Azure Database and also Don't forget to Add your database as linked resource to your azure Web Site from azure Portal
regards
Mohammed
Tuesday, March 17, 2015 4:41 PM -
It is certainly not a problem of connection as I can see my database and work with it. The problem appears only when I run a long method to fill the DB with new stuff.
Yves
Yves Pflieger
Tuesday, March 17, 2015 5:11 PM -
I call a generic Handler which will fill my database (so it will call some SaveChanges). I have put this call in my client in a ShowProgress method:
msls.showProgress( msls.promiseOperation(function (operation) { msls.promiseOperation(methode).then(function PromiseSuccess(PromiseResult) { operation.complete(PromiseResult); }, function error(e) { operation.error(e); }) }) .then(function completed(result) { msls.showMessageBox(strSucces + " (returnValue:" + result + ")"); }, function error(e) { msls.showMessageBox(strErreur + " " + e.status + "\n" + e.statusText + "\n" + $(e.responseText).text()); }) );
When tracing and using also F12 I get a 500 Servererror with no additional info...
Is there any timeout or things like that in the Showprogress call ??
I have the feeling that even that I get the 500 servererror, the generic Handler is able to finish its job...
By the way, your book "Creating HTML 5 Websites and Cloud Business Apps unsing Lightswitch in Visual Studio 2013" is very interesting. Nice work!
Yves Pflieger
Wednesday, March 18, 2015 11:06 AM -
Thank you for your support :)
I have never tried this, but see if you can use this to set a break point in the .ashx handler:
Unleash the Power - Get the LightSwitch 2013 HTML Client / SharePoint 2013 book
Wednesday, March 18, 2015 12:18 PM -
Yes I can put breakpoints in the .ashx Handler, I have put some in the try catch but it this internal server error does not seem to be produced by my code...
Yves Pflieger
Wednesday, March 18, 2015 12:44 PM -
The only thing I can think of is to run SQL Server Profiler to see if any errors show up there. I don't know how to do that with Azure but perhaps you can Google it.
Unleash the Power - Get the LightSwitch 2013 HTML Client / SharePoint 2013 book
Wednesday, March 18, 2015 2:14 PM -
I have the feeling that it is a problem of a SQL Transient fault due to the fact that at some time I hit the service too frequently (a loop add some more of 20.000 entities).
The question is: should I install the Nuget TOPAZ Transient fault handling application block or is Lightswitch doing it in some ways?
I am refering me to these links:
https://msdn.microsoft.com/en-us/library/dn589788.aspx
Yves Pflieger
Saturday, March 21, 2015 10:30 AM -
It can be that the server is simply timing out. I would launch a thread and perform the insert using ADO.NET.
(because you wont have "user context" to use the normal LightSwitch "insert to the database" code if you launch a thread. But that is ok because an ADO.NET call just needs to read the connection string to the database that is in the web.config).
Sorry I don't have any examples :(
Unleash the Power - Get the LightSwitch 2013 HTML Client / SharePoint 2013 book
- Proposed as answer by ampse Monday, December 28, 2015 2:58 AM
Saturday, March 21, 2015 1:22 PM -
I do not think this is a time out problem as I have set a ScriptTimeout of 1800...
The strange thing is that if I call exactly the same code (method ResetDB.Remplir()) in a PreprocessQuery, it runs without error! Here below is the Generic Handler call:
public void ProcessRequest(HttpContext context) { string strResponse = ""; context.Server.ScriptTimeout = 1800; // 1800 secondes = demi-heure try { strResponse = ResetDB.Remplir().ToString(); } catch (Exception ex) { strResponse = Utils.ShowError(ex); } context.Response.ContentType = "text/plain"; context.Response.Write(strResponse); }
The only subtil difference is that ResetDB.Remplir() call this code:
serverContext = Utils.GetServerContext();
that will in once case create a new serverContext and in the other case use the Current context. Any idea?
Yves Pflieger
- Edited by Yves Pflieger Saturday, March 21, 2015 3:57 PM
Saturday, March 21, 2015 3:55 PM -
Any idea?
Yves Pflieger
Sorry I have nothing :(Unleash the Power - Get the LightSwitch 2013 HTML Client / SharePoint 2013 book
Saturday, March 21, 2015 6:08 PM -
Your idea of implementing some of the intensive code for filling the database with ADO.NET was a very good idea. It is very very fast compared to the Lightswitch SaveChanges method and, now, I do not have any Internal Server error any more.
Thanks for the hint!
Yves Pflieger
- Marked as answer by Yves Pflieger Thursday, March 26, 2015 8:56 AM
Thursday, March 26, 2015 8:56 AM