NLog asp.net core sends email automatically on error without logging it - email

This is a weird situation, NLog users usually contact when NLog does not send emails but I am contacting you because NLog is sending emails.
I configured NLog using UseNLog(). I have nlog.config file. Thats it. Nothing else is set to configure it.
Nlog.config file just have target set to email me.
I do not even inject Logger in any OData controller.
It is a Asp.net Core project.
I am manually throwing exception from one of my controller. And it sends me email.
I am not even calling Logger.LogError().
How is this happening?

NLog integrates with ASP.NET Core logging. That isn't only a logger abstraction, but also ASP.NET Core is writing logs to that abstraction (debug info, http calls, errors etc).
So if ASP.NET Core catches an exception, it will write to the logging abstraction and NLog is configured to process the logging with UseNLog and the nlog.config.
This will be probably more clear if you set-up the internal log of NLog, it shows the internals.
See also the getting started with NLog and ASP.NET Core 2, in the example below you will see some output examples.

Related

Adding an AuthorizationHandler via config

In WCF, you can add an authorization policy through the web.config by using the serviceAuthorization node in a service behavior. Is there a way to include an AuthorizationHandler in .NET Core WebAPI via config?
To be clear, I'm trying to replace this line in Startup.cs with something in the web.config:
services.AddSingleton<IAuthorizationHandler, MyAuthorizationHandler>();
web.config is only used for IIS specific config. Because of .net-core's cross platform nature they ditched coupling to web config for application configuration.
A web.config file is required when hosting the app in IIS or IIS Express. Settings in web.config enable the ASP.NET Core Module to launch the app and configure other IIS settings and modules.
Reference Configure an ASP.NET Core App: The web.config file
Startup is your entry point into the application where you can have some settings in the json file and have your code add/update the configuration based on that.
My thinking is that it would save having to recompile every time you want to add something because configuration options allows you to Reload configuration data with IOptionsSnapshot
Requires ASP.NET Core 1.1 or later.
IOptionsSnapshot supports reloading options with minimal processing overhead. In ASP.NET Core 1.1, IOptionsSnapshot is a snapshot of IOptionsMonitor<TOptions> and updates automatically whenever the monitor triggers changes based on the data source changing. In ASP.NET Core 2.0 and later, options are computed once per request when accessed and cached for the lifetime of the request.
Your authorization handler(s) would depend on the options and perform its function based on the configurations provided.

Unable to integrate CQ5.6.1 with Site Catalyst

I'm having difficulty in integrating AEM 5.6.1 with Site Catalyst. It allows me to connect in the configuration successfully, but does not work on the framework setup.
I've followed the standard procedure to connect AEM to SC and it accepts my login in the configuration, but fails on the framework set up with the browser message 'We were not able to login to SiteCatalyst. Please check your credentials and try again.'. Behind the scenes in the server log;
12.12.2014 14:10:06.967 *WARN* [0:0:0:0:0:0:0:1 [1418393406764] POST /libs/cq/analytics/sitecatalyst/service.json HTTP/1.1] com.day.cq.analytics.sitecatalyst.impl.SitecatalystHttpClientImpl Data center 'https://api3.omniture.com/admin/1.3/rest/' responded with errors {"error":{"code":500,"message":"Internal Server Error"}}
12.12.2014 14:10:06.967 *ERROR* [0:0:0:0:0:0:0:1 [1418393406764] POST /libs/cq/analytics/sitecatalyst/service.json HTTP/1.1] com.day.cq.analytics.sitecatalyst.impl.servlets.SitecatalystServlet Call to SiteCatalyst method 'Company.GetReportSuites' failed com.day.cq.analytics.sitecatalyst.SitecatalystException: not authenticated
I've tried accessing via the API Explorer and it works.
I've tried the troubleshooting guide without success.
I can log in to Site Catalyst, I'm an admin, I am in the web services access group.
I've tried using a clean install of CQ5.6.1 with geometrixx - it doesn't work either.
I've tried this from a server and from a localhost/dev machine with the same results. No proxy. I've even tried using the shared secret as the password but then it doesn't connect at all, and fails on the configuration screen.
What might cause this to fail?
If it doesn't work with a fresh install and Geometrixx, then it's probably an Adobe bug. That's typically the first thing support will ask you about.
I would also verify using Geometrixx Outdoors, or a more recent demo site, on your fresh install, just to ensure it's not an outdated ClientLib issue.
I know this isn't a direct answer to your question, but honestly, I would approach the integration differently. I've worked with the AEM-SC framework and it's buggy at best. It's very finicky, it doesn't REALLY work the way the documentation claims, and it requires that you're very specific about what Clientlibs are on the page.
Moving forward, I think using Adobe Dynamic Tag Manager is the better approach, for many reasons. My understanding is that it's Adobe's recommendation as well. I'd consider moving to that. In AEM 5.6.1, you'll have to customize your integration with DTM, but it's not very hard.
Solution: Add a property on the configuration node for sitecatalyst: (eg. /etc/cloudservices/sitecatalyst/my-sc-configuration)
server=https://api.omniture.com/admin/1.2/rest/
it also seems to work with newer API versions such as https://api3.omniture.com/admin/1.3/rest/
It would appear that for 5.6.1 it ignores the OSGi configuration, at least for the configuration screens. With this extra property, the framework page loads without error and allows selection of the RSID.

Consume ServiceStack SOAP service from Silverlight application

For the past few days I have been looking at ServiceStack as a replacement for our WCF-based middleware (that exposes SOAP services).
My two main requirements :
Can be hosted outside of IIS (no problem using AppHostHttpListenerBase)
ServiceStack SOAP interfaces can be consumed from a Silverlight application.
Hosting from a console application works smoothly, but adding a service reference in my Silverlight client gives the following warning:
Custom tool warning: Endpoint 'WSHttpBinding_IOneWay' at address 'http://localhost:8080/soap12' is not compatible with Silverlight 5. Skipping...
Which makes sense, but I cannot seem to find a way to change the binding to e.g. basicHttpBinding.
Is this possible? I tried various ways to tackle this from app.config but no luck so far.
Much obliged in advance,
Robert van Drunen

ZK with Websphere Application Server - Timeout on any Event

I have started working with ZK recently. I really like the framework but I am having a lot of problems in configuring it to work correctly with Websphere Application Server v8.0. Namely, I am developing an EJB application with accessing the database via JPA entities and using the ZK framework for GUI. I am developing the application using the Rational Software Architect 8.5.
When I start working on a fresh ZK project in a fresh workspace and server profile everything seems to be working correctly. However, after some time I start having strange problems. I think the problem occurs in the moment when ZK tries to initialize my ViewModel class. I do not get any exceptions or errors, but get the timeout message in my browser: "The page or component you request is no longer available. This is normally caused by timeout, opening too many Web pages, or rebooting
the server."
My ViewModel initializes by resolving the EJB bean I am using for business logic. That normally works, but as I said, after working for some time on the project, or after restarting my computer the ViewModel object cannot get initialized and the timeout error appears no matter what I do (when ZK tries to bind a variable or when I fire an event needed to be handled by my ViewModel. As before, I do not get any additional errors or exceptions.
Has anybody already had this problem? Is there a solution? Can I change the configuration of my server or ZK to avoid this problem?
Thank you.
Seems that I have solved the problem myself. I was using internal Rational Software Architect (Eclipse) browser which apparently has problems handling ZK sessions. When I switched to Firefox, the problems I explained stopped appearing.

weborb and wcf service library with ado .net entity framework

i've created a wcf service library with ado .net entity framework to handle the retrieving of data from the database and send it to the user.
i've been testing it in visual studio without any problems.
so, i moved the dll of the service and the xml configuration file to the bin folder of weborb, changed the web.config to add my service.
but when i invoke the service from the webconsole i get this error:
>The server was unable to process the request due to an internal
>error. For more information about the error, either turn on
>IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute
>or from the <serviceDebug> configuration behavior) on the server in
>order to send the exception information back to the client, or turn on
>tracing as per the Microsoft .NET Framework 3.0 SDK documentation and
>inspect the server trace logs"
can anyone give any help with this?
how can i get a working wcf service library using ado .net entity framework in weborb?
help would be appreciated.
thanks in advance.
Have you checked the WebORB log?
Then start off by trying the WebORB examples from here.
The WebORB log should give you more detail about the error. With that info, I would post a question on the WebORB forum.