如何配置NLog v4使用VistaDB5数据库?


string connString = string.Format("'{0}';Pooling=False;Open Mode=NonExclusiveReadWrite;Password=Galwaypipe001", path);
DatabaseTarget dbt = new DatabaseTarget();
dbt.Name = "NLog Database";
dbt.ConnectionString = connString; // connStringBuilder.ConnectionString; // connString;
dbt.DBProvider = "VistaDB.Provider, VistaDB.5.NET40, Version=5.0.0.0, Culture=neutral";

上面的结果是:

2016-10-22 11:07:12.7492 Trace Database Target[NLog Database] has 15 layouts
2016-10-22 11:07:12.8593 Error Error initializing target 'Database Target[NLog Database]'. Exception: System.TypeLoadException: Could not load type 'VistaDB.Provider' from assembly 'VistaDB.5.NET40, Version=5.0.0.0, Culture=neutral'.
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.Type.GetType(String typeName, Boolean throwOnError)
at NLog.Targets.DatabaseTarget.InitializeTarget()
at NLog.Targets.Target.Initialize(LoggingConfiguration configuration)
            VistaDBConnectionStringBuilder connStringBuilder = new VistaDBConnectionStringBuilder();
            connStringBuilder.Password = "***";
            connStringBuilder.DataSource = pathandFilenameTovdb5DB;
            connStringBuilder.Pooling = false;
            connStringBuilder.OpenMode = VistaDB.VistaDBDatabaseOpenMode.NonexclusiveReadWrite;
            DatabaseTarget dbt = new DatabaseTarget();
            dbt.Name = "NLog Database";
            dbt.DBProvider = "VistaDB.Provider.VistaDBConnection, VistaDB.5.NET40,  Version=5.0.0.0, Culture=neutral, PublicKeyToken=dfc935afe2125461";
            dbt.ConnectionString = connStringBuilder.ConnectionString;

相关内容

  • 没有找到相关文章

最新更新