What is the best way to log the exceptions caught in WCF service hosted on cloud?
相关问题
- Generic Generics in Managed C++
- running headless chrome in an microsoft azure web
- Docker task in Azure devops won't accept "$(pw
- How to Debug/Register a Permanent WMI Event Which
- 'System.Threading.ThreadAbortException' in
You can take advantage of System.Diagnostics and logging your exceptions with
Trace.traceError()
. You can then schedule these trace statements to be periodically uploaded to table storage (maybe once a minute?), where you can then retrieve and analyze the trace statements either with an on-premise app or one running in a worker role.For example: in your worker role's OnStart(), customize the Diagnostic Manager to upload your trace data to table storage. In this example, it's uploading every minute, to the storage account specified in DiagnosticsConnectionString (this is, by default, set up to point to dev storage):
Then, whenever you encounter an exception in your WCF Service, log it:
Finally, either write some code to query the diagnostic data, or use something like the new built-in Visual Studio storage explorer to view and act on the errors.