Get remote errors in Service Fabric using Web Api - asp.net-web-api

Web API has GlobalConfiguration.Configuration.IncludeErrorDetailPolicy
= IncludeErrorDetailPolicy.Always; to turn on remote errors. (Allowing them to see them in a browser even if you are not browsing on the local machine.
But, near as I can tell, Service Fabric, running Web Api, does not support GlobalConfiguration.
Is there a way to configure things so I don't have to log into one of my Service Fabric server machines each time I want to see what a services error message is?

I recommend you don't show error details to everyone.
It's a security risk.
Consider moving your error logs out of your cluster. For instance, by using OMS, ELK or Application Insights.

Related

How to find the cause of HTTP 500 Error for GKE deployment?

I have deployed a Spring Boot application onto a Google Kubernetes Engine workload. First, I pushed an image to Artifact Registry. Then, I ran the image using the docker run command in the gcloud command line. My GET request worked perfectly fine then, but once I deployed the image to a Kubernetes workload, the same GET request to the LoadBalancer returned a 500 Internal Server HTTP error.
Everytime I try going on Google's Error Reporting, it tells me to setup Error Reporting, but I don't really understand how to, and besides I thought HTTP errors automatically went to Error Reporting.
I'm sorry if there's too many extra details, I mainly want to know how to see the cause of an HTTP 500 error on a GKE deployment?

.NET 6 webapp returns 503 error on random intervals

I published a simple .NET 6.0 web app with user authentication on my IIS 10.0 web server hosted on Azure.
The application read and write data from a SQL Server 2017 database hosted on another machine on the same virtual network of the web server.
Everything works fine but after a while, even though nobody is using the app, it stop working and send Http Error 503 Service Unavailable and I have to restart it every time from the application pool.
I enabled tracing on the event log, but I don't receive any message explaining this.
These are the application settings:
IIS application settings
I tried to follow these advices but none of them worked:
IIS HTTP Error 503. The service is unavailable
503 “Service Unavailable” error for all apps after installing .NET Core 2.2 Runtime & Hosting Bundle for Windows
.Net core Service Unavailable after Publish to IIS
On the same web server I have other applications but this problem appears only on this one. None of the other apps is using .NET 6, most use .NET Framework 4.7/4.8 and another couple .NET Core 3.1.
I also tried to publish the application on Azure WebApp service and it has the same problem.
1. If you're deploying on IIS, we can install DebugDiag Tools and then use the DebugDiag collection to crawl the dump logs.
2. If you are using the azure app service, it is recommended to get dump in the azure portal.
My Suggestion
Enable Failed Request Tracing, and find which request will cause the Http 503.
Maybe this 503 is not a problem with the code, and it is possible to find some useful information in the log.
Check the EventViewer, try to find the useful info about the application.
Download the DebugDiag Tools, use debugdiag collection to collect the dump file when the issue occured, and use the debugdiag analysis to analyze the dump file and check the stacktrace.
My suggestion can't tell you the root cause directly, but it will help you to find it. You are also welcome to update the useful stacktrace information in the future, and there will be more people to help you.
I'm currently having the issue but using MySQL on a remote server.
Azure WebApp, Azure VM (IIS 10) and AWS EC2.
Http Error 503 Service Unavailable when the database connection timesout or fails to connect and the AppPool failed to restart.
No crashes when debugging in VS via console app.
I changed the hosting model to out-of-process and this solved the issue.
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="outofprocess">

Can't make a POST request to REST API

GET, PUT, DELETE request work fine, but everytime i make a POST request I get an 500 status code. I have no idea where to start debuggin or what to look for. My api is depolyed on Microsoft Azure.
Any tips on what to look for or how to solve this issue would be much appriciated. I know a 500 status code, could be pretty much anything, but i find it really wierd that POST is the only request that dosn't work.
I have no idea where to start debuggin or what to look for. My api is depolyed on Microsoft Azure.
Please make sure your API application could run fine locally before you deploy it to Azure. Besides, http 500 error indicates the server encountered an unexpected condition, if you deploy your app to Azure app service, you could remote debugging web apps to troubleshoot the issue. If you publish it as cloud service Web role, you could try to use Azure compute emulator to debug your cloud service on a local machine.

View Azure cloud service IIS logs

I have created a simple MVC3 site that displays data from a table in an Azure database. I have created a cloud service to run the site in and can publish it successfully. I have also run the site successfully in the Azure emulator.
My problem is that when I select the page that displays the data there is an error as I get the default error page. I think I have the db connections set correctly but I cannot see any logs. So my questions are:
Where are the IIS logs? I would like to see what the error is.
Are there any other logs/diagnostics that I can use to see what the problem is?
Thanks.
By default the only place where something might be logged is in the Windows Application Event Log. You'll need to Remote Desktop to the cloud service instance (Connect from the Instances page in the Azure Management Portal) and then open Event Viewer.
The IIS logs themselves should be available too although as per normal IIS logs these won't contain exception details. Use IIS Manager > Application > Logging when logged on to the instance to find the location.
As suggested by Magnus, you should use something like Windows Azure Diagnostics and/or ELMAH and/or log4net to log exception and diagnostic information to somewhere accessible for troubleshooting.
I suggest you use Windows Azure Diagnostics to collect your logs.
You can read all(setup and usage) about it here:
http://msdn.microsoft.com/en-us/library/windowsazure/gg433048.aspx

AppHarbor's IIS logs

Is there a way to get the IIS logs for a website hosted on AppHarbor? I have one site hosted on it and I am getting run time exception. Currently I get a suggestion that I should enable custom errors to view the exception. I don't want to do this since it is a deployed instance which is being used by users.
The IIS logs are not currently available but you can access unhandled exceptions in the error interface on AppHarbor.
You can also use something like Elmah (appropriately locked down) to record and inspect errors.
We're working on making HTTP access logs available too.

Resources