Castle Windsor error using log4net in WinForm app - winforms

I've this error using Windsor Castle with log4net in WinForm application.
Error:
Could not convert from 'Castle.Services.Logging.Log4netIntegration.Log4netFactory,Castle.Services.Logging.Log4netIntegration,Version=2.5.1.0, Culture=neutral,PublicKeyToken=407dd0808d44fbdc' to System.Type - Maybe type could not be found
Stack:
in Castle.MicroKernel.SubSystems.Conversion.TypeNameConverter.PerformConversion(String value, Type targetType) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\SubSystems\Conversion\TypeNameConverter.cs:riga 91
in Castle.MicroKernel.SubSystems.Conversion.DefaultConversionManager.PerformConversion(String value, Type targetType) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\SubSystems\Conversion\DefaultConversionManager.cs:riga 134
in Castle.MicroKernel.SubSystems.Conversion.DefaultConversionManager.PerformConversion[TTarget](String value) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\SubSystems\Conversion\DefaultConversionManager.cs:riga 162
in Castle.Facilities.Logging.LoggingFacility.GetLoggingFactoryType(LoggerImplementation loggerApi)
in Castle.Facilities.Logging.LoggingFacility.CreateProperLoggerFactory(LoggerImplementation loggerApi)
in Castle.Facilities.Logging.LoggingFacility.ReadConfigurationAndCreateLoggerFactory()
in Castle.Facilities.Logging.LoggingFacility.Init()
in Castle.MicroKernel.Facilities.AbstractFacility.Castle.MicroKernel.IFacility.Init(IKernel kernel, IConfiguration facilityConfig) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\Facilities\AbstractFacility.cs:riga 85
in Castle.MicroKernel.DefaultKernel.AddFacility(String key, IFacility facility) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\DefaultKernel.cs:riga 320
in Castle.MicroKernel.DefaultKernel.AddFacility[T](Func`2 onCreate) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\MicroKernel\DefaultKernel.cs:riga 377
in Castle.Windsor.WindsorContainer.AddFacility[T](Func`2 onCreate) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\Windsor\WindsorContainer.cs:riga 629
in IocWinFormTest.Installers.LoggerInstaller.Install(IWindsorContainer container, IConfigurationStore store) in C:\Sviluppo\IocWinFormTest\IocWinFormTest\IocWinFormTest\Installers\LoggerInstaller.cs:riga 18
in Castle.Windsor.WindsorContainer.Install(IWindsorInstaller[] installers, DefaultComponentInstaller scope) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\Windsor\WindsorContainer.cs:riga 324
in Castle.Windsor.WindsorContainer.Install(IWindsorInstaller[] installers) in e:\OSS.Code\Castle.Windsor\src\Castle.Windsor\Windsor\WindsorContainer.cs:riga 674
in IocWinFormTest.Program.Main() in C:\Sviluppo\IocWinFormTest\IocWinFormTest\IocWinFormTest\Program.cs:riga 22
in System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
in System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
in System.Threading.ThreadHelper.ThreadStart_Context(Object state)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
in System.Threading.ThreadHelper.ThreadStart()
the code:
public class LoggerInstaller : IWindsorInstaller
{
#region IWindsorInstaller Members
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.AddFacility<LoggingFacility>(f => f.LogUsing(LoggerImplementation.Log4net).WithAppConfig());
}
#endregion
}
App.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<logger name="NHibernate">
<level value="WARN" />
</logger>
<logger name="NHibernate.SQL">
<level value="ALL" />
<appender-ref ref="RollingFile" />
</logger>
<root>
<level value="DEBUG" />
<appender-ref ref="RollingFile" />
<appender-ref ref="trace" />
</root>
<appender name="trace" type="log4net.Appender.TraceAppender">
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value=" %date %level %message%newline" />
</layout>
</appender>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Public\Log" />
<appendToFile value="true" />
<datePattern value=".yyyyMMdd.\tx\t" />
<rollingStyle value="Date" />
<param name="StaticLogFileName" value="false" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d %-8ndc %-5thread %-5level %logger %message %timestampms %n" />
</layout>
</appender>
</log4net>
</configuration>
I used NuGet to import all packages and interesting story is that I've the same configuration in a web app and there it works!
Can you help me?
Daniele

Have you copied the Castle.Services.Logging.Log4netIntegration.dll and all other required assemblies to your project's folder?

Change the target of the WinForm app from the Client Profile to the .Net Framework. log4net depends on System.Web as a support assembly. The answer to my question has more details if you want to stay targeting the Client Profile.
Why does log4net 1.2.10 require System.Web?

Related

log4net logger logging unexpected levels based on config

I have been trying to understand the config of the log4net library and I think I have it except for some unexpected behavior.
I have a root logger that has a level set to INFO and another logger for a specific class that has level set to ERROR.
What I expected from this was that the class logger would only log at error and ignore the roots level since I had additivity set to false for the class logger. Here is the log4net.config I have at the moment:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<log4net>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="log.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="100KB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<logger name="EveStatic.Config.ViewModel" additivity="false">
<level value="error"/>
<appender-ref ref="ConsoleAppender"/>
<appender-ref ref="RollingFileAppender"/>
</logger>
<root>
<level value="debug" />
<appender-ref ref="ConsoleAppender" />
<appender-ref ref="RollingFileAppender" />
</root>
</log4net>
</configuration>
In my AssemblyInfo.cs:
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
And in the class that loads the configuration:
log4net.Config.XmlConfigurator.Configure(new FileInfo("log4net.config"));
These two seem redundant but the configuration wont load unless I have the code part. Everything here is in a class library being used by another project.
Is this behavior expected and I don't understand the configuration and level overrides or am I forgetting something?
EDIT:
Here is how I instantiate and call the ILog. The the full class name is the name of the logger in the config plus the ConfiInfoViewModel:
private static readonly ILog LOG = LogManager.GetLogger(typeof(ConfigInfoViewModel));
...
LOG.Debug("Something buggy");
Also note that when testing the logging levels I had a log statement for each level in a series.
Your problem lays here
LogManager.GetLogger(typeof(ConfigInfoViewModel));
Internally this get resolved to
LogManager.GetLogger(typeof(ConfigInfoViewModel).FullName);
Now log4net is looking for a Logger named "EveStatic.Config.ConfigInfoViewModel" (result of typeof(ConfigInfoViewModel).FullName)
Because no Logger with that name is specified a new one with your default settings is used.
Also note that level specify a threshold, not a single level.
Example: level=warn means log warn an all levels above (error and fatal)

WPF log4net is not writing to the log file [duplicate]

This question already has an answer here:
WPF-Log4Net used inside VSIX extension did not output log when installed at target VS
(1 answer)
Closed 4 years ago.
I have a WPF solution. I downloaded log4net dll, I added log4net.config and had set the "Copy to Output Directory" value as "Copy always".
log4net.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<log4net>
<root>
<level value="ALL" />
<appender-ref ref="LogFileAppender" />
</root>
<appender name="LogFileAppender" type="log4net.Appender.FileAppender">
<file value="myapp.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="5" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %level %logger - %message%newline" />
</layout>
</appender>
</log4net>
</configuration>
And I added the below line in AssemblyInfo.cs:
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
then the below code in my TestWindowControl.xaml.cs
public partial class TestWindowControl : UserControl
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public TestWindowControl()
{
XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));
log.Info("info testing");
log.Debug("debug testing");
log.Error("error testing");
log.Fatal("fatal testing");
log.Warn("warn testing");
}
}
But logs are not writing to the file. It's working in Console application but not working for WPF. Am I missing something?
Try to set the filter inside appender
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="WARN" />
<levelMax value="ERROR" />
</filter>

What is wrong with this log4.net configuration?

It sure looks like it should work. It throws no errors, steps through every line of code, but produces no log file. What is wrong here? It should produce a log file in the directory of the appender name, but no log file ever generates.
log4net.xml file:
<configuration>
<log4net debug="true">
<appender name ="task_appender" type="log4net.Appender.RollingAppender">
<file value="C:\Users\ryan\Documents\Visual Studio 2017\Workout Project\GPWorkouts\blablabla.txt"></file>
<appendToFile value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBacks value="2"/>
<maximumFileSize value="5000KB"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline"></conversionPattern>
</layout>
</appender>
<root>
<level value="DEBUG"/>
</root>
<logger name="Task">
<level value="DEBUG"/>
<appender-ref ref="task_appender"/>
</logger>
</log4net>
</configuration>
application file:
public partial class MainWindow : Window
{
static protected ILog log = LogManager.GetLogger("Task");
static void log4net_demo()
{
FileInfo fi = new FileInfo("log4net.xml");
log4net.Config.XmlConfigurator.Configure(fi);
log4net.GlobalContext.Properties["host"] = Environment.MachineName;
}
public MainWindow()
{
InitializeComponent();
log4net_demo();
log.Info("This is the information log level");
log.Debug("This is the debugging log level");
log.Error("This is the error log level");
log.Fatal("This is the fatal log level");
}
Looks like some typo in your log4net config, the correct appender type name is log4net.Appender.RollingFileAppender
In your xml, it was given as log4net.Appender.RollingAppender
Here is the corrected xml
<configuration>
<log4net debug="true">
<appender name ="task_appender" type="log4net.Appender.RollingFileAppender">
<file value="C:\Users\ryan\Documents\Visual Studio 2017\Workout Project\GPWorkouts\blablabla.txt"></file>
<appendToFile value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBacks value="2"/>
<maximumFileSize value="5000KB"/>
<staticLogFileName value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline"></conversionPattern>
</layout>
</appender>
<root>
<level value="DEBUG"/>
</root>
<logger name="Task">
<level value="DEBUG"/>
<appender-ref ref="task_appender"/>
</logger>
</log4net>
</configuration>

Detecting SQL server install directory

I am trying to find the install directory for SQL server. So that I can copy the dlls for a custom SSIS task into it.
The following code runs but its not copying my files. Its not stopping either so I am assuming that it has found some value for ISSQLSERVERSERVICEINSTALLED
I am very new to wix this is the first time I have tried to read from the register.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Daimto OpenWeather for SSIS" Language="1033" Version="1.0.0.0" Manufacturer="DAIMTO" UpgradeCode="84543418-55c4-48c0-b5be-2496fb84ffb6">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perUser" InstallPrivileges="elevated" AdminImage="yes" />
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Feature Id="SSISMSSQL" Title="SSIS Components" Display='expand' Level='1'>
<ComponentRef Id='SSISPipelineComponents' />
<ComponentRef Id='SSISConnections' />
</Feature>
<UIRef Id="WixUI_Minimal"/>
</Product>
<!-- Get the directory name-->
<Fragment>
<Property Id="SQLSERVERINSTALLFOLDER">
<RegistrySearch Id='InstallDir'
Type='raw'
Root='HKLM'
Key="SOFTWARE\Microsoft\Microsoft SQL Server\100" Name="VerSpecificRootDir" />
</Property>
<Condition Message='Install Folder not found'>SQLSERVERINSTALLFOLDER</Condition>
</Fragment>
<!-- Build directory structure. http://blogs.msdn.com/b/syamp/archive/2012/09/30/wix-search-for-install-path-from-registry.aspx -->
<Fragment>
<Directory Id = "TARGETDIR" Name="SourceDir">
<Directory Id="SQLSERVERINSTALLFOLDER" >
<Directory Id="DTSDir" Name="DTS">
<Directory Id="PIPELINECOMPONENTS" Name="PipelineComponents" />
<Directory Id="CONECTIONS" Name="Connections" />
</Directory>
</Directory>
</Directory>
<!-- Set tarit dir to c: -->
<SetDirectory Id="TARGETDIR" Value="[WindowsVolume]" />
</Fragment>
<!-- copie files. -->
<Fragment>
<ComponentGroup Id="SSISPipelineComponentsgrp" Directory="PIPELINECOMPONENTS">
<Component Id="SSISPipelineComponents" Guid="{51CE96C7-42BF-4CE7-AE88-5C0085868062}" >
<File Id="Daimto.SSIS.Tasks.Current" Name="Daimto.SSIS.Tasks.Current.dll" DiskId="1" KeyPath="yes" Source="$(var.Daimto.SSIS.Tasks.Current.TargetPath)" />
</Component>
</ComponentGroup>
<ComponentGroup Id="SSISConnectionsgrp" Directory="CONECTIONS">
<Component Id="SSISConnections" Guid="{8DFFB861-18E4-4E08-8D4E-CAD99911E8A8}" >
<File Id="Daimto.SSIS.Connection" Name="Daimto.SSIS.Connection.dll" DiskId="1" KeyPath="yes" Source="$(var.Daimto.SSIS.Connection.TargetPath)" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
Update 1:
added "InstallPrivileges="elevated"" doesn't appear to help
adding a picture of reg.
Update 2:
I am getting some where. Its now installing on my Ddrive....
MSI (c) (CC:98) [13:37:09:112]: PROPERTY CHANGE: Adding TARGETDIR property. Its value is 'D:\'.
MSI (c) (CC:98) [13:37:09:112]: PROPERTY CHANGE: Adding ISSQLSERVERSERVICEINSTALLED property. Its value is 'D:\'.
MSI (c) (CC:98) [13:37:09:112]: PROPERTY CHANGE: Adding DTS property. Its value is 'D:\DTS\'.
MSI (c) (CC:98) [13:37:09:113]: PROPERTY CHANGE: Adding CONECTIONS property. Its value is 'D:\DTS\Connections\'.
MSI (c) (CC:98) [13:37:09:113]: PROPERTY CHANGE: Adding PIPELINECOMPONENTS property. Its value is 'D:\DTS\PipelineComponents\'.
Which leads me to believe that its not finding ISSQLSERVERSERVICEINSTALLED.
update 3:
Its now installing on the c drive. but its creating a directory called SQLSERVERINSTALLFOLDER, its not taking a value. log file says that the value of SQLSERVERINSTALLFOLDER is c: I cant figure out if its even able to find the registry value or not. I tried adding a condition to force it to fail but its not failing
<Condition Message='Install Folder not found'>SQLSERVERINSTALLFOLDER</Condition>
I finally got it working, the problem was that the fragment wasint being called I had to add <ComponentGroup Id="Fake" /> to the fragment then declare it with the other componentRefs.
The following code detects sqlserver 2008 copyes the connection manager and the data reader to the correct dts folders and installs them both in GAC after.
Hope this helps someone.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Daimto for SSIS (SQL Server 2008)" Language="1033" Version="1.0.0.0" Manufacturer="DAIMTO" UpgradeCode="84543418-55c4-48c0-b5be-2496fb84ffb6">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perUser" InstallPrivileges="elevated" AdminImage="yes" />
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Feature Id="SSISMSSQL" Title="SSIS Components" Display='expand' Level='1'>
<ComponentRef Id='SSISPipelineComponents' />
<ComponentRef Id='SSISConnections' />
<ComponentGroupRef Id="CopyGAC"/>
<ComponentGroupRef Id="Fake"/>
</Feature>
<UIRef Id="WixUI_Minimal"/>
</Product>
<!-- Get install location of SQL Server 2008 -->
<Fragment>
<Property Id="SQLSERVERINSTALLFOLDER">
<RegistrySearch Id='InstallDir'
Type='directory'
Root='HKLM'
Key="SOFTWARE\Microsoft\Microsoft SQL Server\100" Name="VerSpecificRootDir" />
</Property>
<Condition Message='Install Folder not found'>SQLSERVERINSTALLFOLDER</Condition>
<ComponentGroup Id="Fake" />
</Fragment>
<!-- map the directory structures -->
<Fragment>
<Directory Id = "TARGETDIR" Name="SourceDir">
<Directory Id="GAC" Name="GAC" />
<Directory Id="SQLSERVERINSTALLFOLDER" >
<Directory Id="DTSDir" Name="DTS">
<Directory Id="PIPELINECOMPONENTS" Name="PipelineComponents" />
<Directory Id="CONECTIONS" Name="Connections" />
</Directory>
</Directory>
</Directory>
<!-- Set TARGETDIR dir to c: -->
<SetDirectory Id="TARGETDIR" Value="[WindowsVolume]" />
</Fragment>
<!-- copie files. -->
<Fragment>
<!-- copy data reader files -->
<ComponentGroup Id="SSISPipelineComponentsgrp" Directory="PIPELINECOMPONENTS">
<Component Id="SSISPipelineComponents" Guid="{51CE96C7-42BF-4CE7-AE88-5C0085868062}" >
<File Id="Daimto.SSIS.Tasks.Current" Name="Daimto.SSIS.Tasks.Current.dll" DiskId="1" KeyPath="yes" Source="$(var.Daimto.SSIS.Tasks.Current.TargetPath)" />
<File Id="Newtonsoft.Json.dll" Name="Newtonsoft.Json.dll" DiskId="1" KeyPath="no" Source="$(var.ProjectDir)Externals\Newtonsoft.Json.dll" />
</Component>
</ComponentGroup>
<!-- copy connection manager file -->
<ComponentGroup Id="SSISConnectionsgrp" Directory="CONECTIONS">
<Component Id="SSISConnections" Guid="{8DFFB861-18E4-4E08-8D4E-CAD99911E8A8}" >
<File Id="Daimto.SSIS.Connection" Name="Daimto.SSIS.Connection.dll" DiskId="1" KeyPath="yes" Source="$(var.Daimto.SSIS.Connection.TargetPath)" />
</Component>
</ComponentGroup>
<!-- copy everything to GAC (remember dlls must be strong name signed.) -->
<ComponentGroup Id="CopyGAC" Directory="GAC">
<Component Id="GACCOPYCurrent" Guid="{4D4E991E-77F5-4CCF-9048-B4C0260B43BD}" >
<File Id="GACDaimto.SSIS.Tasks.Current" Name="Daimto.SSIS.Tasks.Current.dll" KeyPath="yes" Source="$(var.Daimto.SSIS.Tasks.Current.TargetPath)" Assembly=".net"/>
</Component>
<Component Id="GACCOPYJson" Guid="{65E88F62-E73F-4851-9422-6C8D1DA5183F}" >
<File Id="GACNewtonsoft.Json.dll" Name="Newtonsoft.Json.dll" KeyPath="yes" Source="$(var.ProjectDir)Externals\Newtonsoft.Json.dll" Assembly=".net"/>
</Component>
<Component Id="GACCOPYConnection" Guid="{2DCABCEA-62CD-4F0D-BCAC-395A079AF27A}" >
<File Id="GACDaimto.SSIS.Connection" Name="Daimto.SSIS.Connection.dll" KeyPath="yes" Source="$(var.Daimto.SSIS.Connection.TargetPath)" Assembly=".net"/>
</Component>
</ComponentGroup>
</Fragment>
</Wix>

Impossible to create windows forms application using BusinessLogic of Nopcommerce v.1.9

My client ask me something who seems me very simple to do.
He has nopcommerce 1.9 web site , and he wish develop a simple windows forms application to modify clients adresses.
So i tryed to configure a news windows forms project :
static void Main(string[] args)
{
// Code that runs on application startup
NopConfig.Init();
//initialize IoC
IoC.InitializeWith(new DependencyResolverFactory());
//initialize task manager
TaskManager.Instance.Initialize(NopConfig.ScheduleTasks);
TaskManager.Instance.Start();
//open
new FormClient().Show();
TaskManager.Instance.Stop();
}
Then i create a service manager who expose data :
public class ServiceManager
{
public ICustomerService CustomerService;
public ServiceManager()
{
var dbContext = IoC.Resolve<NopObjectContext>();
CustomerService = new CustomerService(dbContext);
}
}
And impossible to access CustomerService methods because resolve method don't find the concrete class to instantiate for NopObjectContext;
(you can find nop commerce 1.9 in this location :
http://nopcommerce.codeplex.com/downloads/get/176949 )
Finally , it works :
App.config must be :
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="NopConfig" type="NopSolutions.NopCommerce.BusinessLogic.Configuration.NopConfig, Nop.BusinessLogic" requirePermission="false"/>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="NopSolutions.NopCommerce.BusinessLogic.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings>
<add key="dependencyResolverTypeName" value="NopSolutions.NopCommerce.BusinessLogic.Infrastructure.UnityDependencyResolver, Nop.BusinessLogic" />
</appSettings>
<connectionStrings>
<add name="NopEntities" connectionString="metadata=res://*/Data.NopModel.csdl|res://*/Data.NopModel.ssdl|res://*/Data.NopModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=EGG-BANKS;Initial Catalog=nopvierge2;Persist Security Info=True;User ID=sa;Password=sqlserver;MultipleActiveResultSets=True;Application Name=EntityFramework"" providerName="System.Data.EntityClient" />
<add name="NopSqlConnection" connectionString="Data Source=DAVID-TOSH\SQLEXPRESS;Initial Catalog=nop;Integrated Security=True;Persist Security Info=False;MultipleActiveResultSets=True;Connect Timeout=120" />
</connectionStrings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
<applicationSettings>
<NopSolutions.NopCommerce.BusinessLogic.Properties.Settings>
<setting name="Nop_BusinessLogic_Clickatell_PushServerWS" serializeAs="String">
<value>http://api.clickatell.com/soap/webservice_vs.php</value>
</setting>
<setting name="Nop_BusinessLogic_EuropaCheckVatService_checkVatService" serializeAs="String">
<value>http://ec.europa.eu/taxation_customs/vies/services/checkVatService</value>
</setting>
</NopSolutions.NopCommerce.BusinessLogic.Properties.Settings>
</applicationSettings>
<NopConfig>
<SqlServer ConnectionStringName="NopSqlConnection"/>
<ScheduleTasks>
<Thread seconds="60">
<!--do NOT enable ClearCache task if you have enabled tracking online users-->
<task name="ClearCache" type="NopSolutions.NopCommerce.BusinessLogic.Caching.ClearCacheTask, Nop.BusinessLogic" enabled="false" stopOnError="false"/>
<task name="PurgeOnlineUsers" type="NopSolutions.NopCommerce.BusinessLogic.Audit.UsersOnline.PurgeOnlineUsersTask, Nop.BusinessLogic" enabled="true" stopOnError="false"/>
<task name="Emails" type="NopSolutions.NopCommerce.BusinessLogic.Messages.SendQueuedMessagesTask, Nop.BusinessLogic" enabled="true" stopOnError="false" maxTries="5"/>
<task name="KeepAlive" type="NopSolutions.NopCommerce.BusinessLogic.Utils.KeepAliveTask, Nop.BusinessLogic" enabled="true" stopOnError="false" path="keepalive/ping.ashx"/>
</Thread>
<Thread seconds="600">
<task name="DeleteExpiredCustomerSessions" type="NopSolutions.NopCommerce.BusinessLogic.CustomerManagement.DeleteExpiredCustomerSessionsTask, Nop.BusinessLogic" enabled="true" stopOnError="false" deleteExpiredCustomerSessionsOlderThanMinutes="43200"/>
<task name="DeleteExpiredShoppingCarts" type="NopSolutions.NopCommerce.BusinessLogic.Orders.DeleteExpiredShoppingCartsTask, Nop.BusinessLogic" enabled="false" stopOnError="false" deleteExpiredShoppingCartsOlderThanMinutes="259200"/>
</Thread>
<Thread seconds="60">
<task name="UpdateExchangeRates" type="NopSolutions.NopCommerce.BusinessLogic.Directory.ExchangeRates.UpdateExchangeRateTask, Nop.BusinessLogic" enabled="true" stopOnError="false"/>
</Thread>
<Thread seconds="3600">
<task name="DatabaseMaintance" type="NopSolutions.NopCommerce.BusinessLogic.Maintenance.DatabaseMaintanceTask, Nop.BusinessLogic" enabled="false" stopOnError="false"/>
</Thread>
</ScheduleTasks>
</NopConfig>
</configuration>
with program.cs file :
static void Main(string[] args)
{
// Code that runs on application startup
NopConfig.Init();
//initialize IoC
IoC.InitializeWith(new DependencyResolverFactory());
//initialize task manager
TaskManager.Instance.Initialize(NopConfig.ScheduleTasks);
TaskManager.Instance.Start();
new form1().show();
TaskManager.Instance.Stop();
}

Resources