这是我的nlog.config文件。我已经启用了throwsException。
我遇到了一个错误 期望 'providerInvariantName' 参数不为空字符串。
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true">
<targets>
<target type="Database" name="databaseLog"
dbProvider="sqlserver" connectionstring="server=.\SQLExpress;database=Movie;integrated security=true">
<commandText>
INSERT INTO [Log] ([Description] , [Level] ) VALUES (@Description, @Level )
</commandText>
<parameter name="@Description" layout="${message}"/>
<parameter name="@Level" layout="${level}"/>
</target>
</targets>
<rules>
<logger name="*" minLevel="Trace" appendTo="databaseLog"/>
</rules>
</nlog>
这样做可以将记录插入数据库。但我想使用connectionstringName而不是重新输入连接字符串。 当我像这样将connectionstring更改为connectionstringname时...
connectionstring="server=.\SQLExpress;database=Movie;integrated security=true"
为了
connectionStringName="ApplicationConnectionString"
我遇到了一个错误 期望 'providerInvariantName' 参数不为空字符串。