I\'m looking for different ways with strengths/weaknesses for converting a console application we are using long term in to a windows service. We use something called java serv
Some thoughts:
Create windows service with VS 2005
install .Net Service
I wrote some couple of years ago a Perl based set of executables ( theads ) etc. , which seems to have similar requirements to yours ...
Some stuff to keep in mind:
Here is a small Console example to output to db, file and console with log4net
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using log4net;
using log4net.Config;
using NUnit.Framework;
namespace ExampleConsoleApplication
{
[TestFixture]
class TestClass
{
//private static readonly ILog logger =
// LogManager.GetLogger ( typeof ( TestClass ) );
private static readonly log4net.ILog logger = log4net.LogManager.GetLogger ( System.Reflection.MethodBase.GetCurrentMethod ().DeclaringType );
static void Main ( string[] args )
{
Console.WriteLine ( " START " );
#region LoggerUsage
DOMConfigurator.Configure (); //tis configures the logger
logger.Debug ( "Here is a debug log." );
logger.Info ( "... and an Info log." );
logger.Warn ( "... and a warning." );
logger.Error ( "... and an error." );
logger.Fatal ( "... and a fatal error." );
#endregion LoggerUsage
TestClass objTestClass = new TestClass();
objTestClass.TestMethodNameOK ();
objTestClass.TestMethodNameNOK ();
Console.WriteLine ( " END HIT A KEY TO EXIT " );
Console.ReadLine ();
} //eof method
[SetUp]
protected void SetUp ()
{
//Add Here the Initialization of the objects
}
[Test ( Description = "Add here the description of this test method " )]
protected void TestMethodNameOK ()
{
//build ok use case scenario here - e.g. no exception should be raced '
//Vegetable newCarrot = pool.GetItemByPropertyValue ( "WriongByPurpose", "Orange" );
//Assert.IsInstanceOfType ( typeof ( Vegetable ), newCarrot );
//Assert.AreSame ( newCarrot, carrot );
//logger.Info ( " I got the newCarrot which is " + newCarrot.Color );
} //eof method
[Test ( Description = "Add here the description of this test method " )]
protected void TestMethodNameNOK () //e.g. the one that should raze Exception
{
//build ok use case scenario here - e.g. no exception should be raced '
//Vegetable newCarrot = pool.GetItemByPropertyValue ( "WriongByPurpose", "Orange" );
//Assert.IsInstanceOfType ( typeof ( Vegetable ), newCarrot );
//Assert.AreSame ( newCarrot, carrot );
//logger.Info ( " I got the newCarrot which is " + newCarrot.Color );
} //eof method
} //eof class
} //eof namespace
#region TheAppConfig
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
#endregion TheAppconfig
//this is the xml added replace here your log4net and Nunit paths
//
// False
// ..\..\..\Log4Net\log4net-1.2.10\bin\net\2.0\release\log4net.dll
//
//