Я делаю веб-приложение MVC с ODP.net и пытаюсь войти в Oracle 11g с nLog 3.1, но продолжаю терпеть неудачу. Конечно, запрос вставки работает нормально, я его протестировал.logging to oracle with nLog
Исключением, которое я получаю, является ниже.
[ArgumentException: Value does not fall within the expected range]
Oracle.DataAccess.Client.OracleCommand.set_CommandType(CommandType value) +119
NLog.Targets.DatabaseTarget.WriteEventToDatabase(LogEventInfo logEvent) +120
NLog.Targets.DatabaseTarget.Write(LogEventInfo logEvent) +133
NLog.Targets.Target.Write(AsyncLogEventInfo logEvent) +46
[NLogRuntimeException: Exception occurred in NLog]
NLog.<>c__DisplayClass1.<Write>b__0(Exception ex) +79
NLog.Internal.SingleCallContinuation.Function(Exception exception) +90
NLog.Targets.Target.Write(AsyncLogEventInfo logEvent) +93
NLog.Targets.Target.WriteAsyncLogEvent(AsyncLogEventInfo logEvent) +218
NLog.LoggerImpl.WriteToTargetWithFilterChain(TargetWithFilterChain targetListHead, LogEventInfo logEvent, AsyncContinuation onException) +168
NLog.LoggerImpl.Write(Type loggerType, TargetWithFilterChain targets, LogEventInfo logEvent, LogFactory factory) +181
NLog.Logger.WriteToTargets(LogLevel level, IFormatProvider formatProvider, T value) +61
NLog.Logger.Info(String message) +25
MyProject.LogHelper.Info(String message) in C:\MyProject\LogHelper.cs:79
MyProject.MvcApplication.Application_Start() in C:\MyProject\Global.asax.cs:45
[HttpException (0x80004005): Exception occurred in NLog]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9936485
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
[HttpException (0x80004005): Exception occurred in NLog]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9950728
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
И конфигурация, которую я использую, приведена ниже.
<nlog autoReload="true"
throwExceptions="false"
xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<!-- add your targets here -->
<target name="LogFile" xsi:type="File" keepFileOpen="true"
fileName="${basedir}/../TempData/Log/${shortdate}.log" layout="${longdate} ${uppercase:${level}} ${newline} ${message} ${newline}"
archiveFileName="${basedir}/../TempData/Log/${shortdate}/$backup_{##}.log" archiveAboveSize="10485760" maxArchiveFiles="10" archiveNumbering="Sequence" />
<target name="LogDatabase" xsi:type="Database" keepConnection="false" useTransactions="true"
dbProvider="Oracle.DataAccess.Client"
connectionString="data source=_tnsname; user id=_userid; password=_password; Validate Connection=true"
commandText="insert into DBOWNER.LOGTABLE(LOG_LOGID, LOG_MESSAGE) values(DBOWNER.SEQ.nextval, :LOG_MESSAGE)">
<parameter name="LOG_MESSAGE" layout="${message}" />
</target>
</targets>
<rules>
<!-- add your logging rules here -->
<logger name="*" minlevel="Trace" writeTo="LogFile" />
<logger name="*" minlevel="Trace" writeTo="LogDatabase" />
</rules>
Пожалуйста, кто может мне помочь !!!