Logging con NLog e SQLite

Questo articolo spiega come ottenere una soluzione di logging portabile ed elegante grazie all’uso di NLog e SQLite, su piattaforma .NET e con poche configurazioni. NLog NLog è una libreria di logging leggera e gratuita che supporta l’ecosistema .NET (Silverlight, Windows Phone, ecc.). Costituisce un’opzione eccellente per un ampio range di scenari: dalle semplici utilities quotidiane a servizi critici di produzione. Consente di avere multipli target, siano essi file, database, console, rete o email. ...

May 6, 2014 · 2 min · Andrea Azzola

Logging with NLog and SQLite

This article explains how to achieve a portable and elegant logging solution with NLog and SQLite on the .NET platform with a few configurations. NLog NLog is a free, lightweight logging library for .NET. It supports many targets (files, databases, console, network, email, and more). nlog-project.org Install (NuGet Package Manager Console) PM> Install-Package NLog SQLite SQLite is a simple embedded database engine. No separate server daemon is required; the database is a single file (e.g., .db3). ...

May 6, 2014 · 2 min · Andrea Azzola

Import Web Service References in .NET

Note (2025): This post refers to .NET Framework 2.0 era tools such as wsdl.exe. Modern .NET projects generally use Connected Services in Visual Studio or dotnet svcutil. The example is preserved for historical reference. You may need to consume Web services from client applications. Visual Studio provides tools for generating proxy classes, which in some cases may be insufficient. In those cases, the wsdl.exe tool is an alternative. The wsdl.exe tool You can use the command prompt tool wsdl.exe, included within the .NET Framework 2.0 SDK. This tool accepts the path to a WSDL file and generates the proxy class automatically. ...

June 9, 2010 · 1 min · Andrea Azzola

Consuming .NET Webservices Using PHP and NuSoap

In my scenario a .NET webservice offers particular encrypting capabilities. I need to consume the webservice with PHP by sending my plain string to get an encrypted one in return. The .NET webservice is working properly. I found the NuSoap library, and adopted it. Here the inclusion: require_once('lib/nusoap.php'); And here the code: // requires web service's specifications aka wsdl // $parameters: // requires following the array 'notation' // array('parameters' => (array('text' => 'Hello World!!!'))); // that equals to Hello World!!! // $proxy (->host, ->port, ->username, ->password) // optional, uses a proxy server function consume_webservice($wsdl, $method, $parameters, $debug = false, $proxy = null) { if ($proxy != null) $proxy->host = $proxy->port = $proxy->username = $proxy->password = false; $client = new soapclient($wsdl, true, $proxy->host, $proxy->port, $proxy->username, $proxy->password); $err = $client->getError(); if ($err) echo 'Constructor error' . $err; $result = $client->call($method, $parameters); // check for a fault if ($client->fault) { echo 'Fault'; print_r($result); } else { // check for errors $err = $client->getError(); if ($err) echo 'Error' . $err; } if ($debug) { echo 'Request' . htmlspecialchars($client->request, ENT_QUOTES); echo 'Response' . htmlspecialchars($client->response, ENT_QUOTES); echo 'Debug' . htmlspecialchars($client->debug_str, ENT_QUOTES); } return $result; } This approach works only with SOAP webservices. Please note that .NET web services include all response content into a “parameters” section by design. ...

October 23, 2007 · 1 min · Andrea Azzola