asp.net-mvc-3 – 使用connectionStringName进行数据库日志记录的nlog
发布时间:2020-05-23 20:58:08 所属栏目:asp.Net 来源:互联网
导读:这是我的nlog.config文件.我已经打开了throwsException. nlog xmlns=http://www.nlog-project.org/schemas/NLog.xsd xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance throwExceptions=true targets
|
这是我的nlog.config文件.我已经打开了throwsException. <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. connectionstring="server=.SQLExpress;database=Movie;integrated security=true" 至 connectionStringName="ApplicationConnectionString" 我收到一个错误 解决方法将System.Data.SqlClient添加到web.config / app.config中连接字符串中的ProviderName属性:<add name="ApplicationConnectionString" providerName="System.Data.SqlClient" connectionString="server=.SQLExpress;database=Movie;integrated security=true;"/> (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- MVC3 .NET会话随机丢失会话值并返回null
- asp.net-mvc – 将id类型从string更改为int时,如何在Web AP
- 将列表绑定到asp.net 3.5中的列表视图
- asp.net – 会话固定 – 表单身份验证
- asp.net-mvc – 添加分页MVC和Azure表存储
- asp.net – MVC 3部署到IIS6
- asp.net-mvc – @ Html.ActionLink如何添加一个查询字符串
- asp.net-mvc – ASP.NET MVC – 创建一个新模型或使用Entit
- ASP.NET MVC:将自定义属性放入选择列表中的选项标签
- ASP.NET登录/成员资格 – 如何注销?
推荐文章
站长推荐
- 如何使用WebAPI没有ASP.NET MVC?
- asp.net-web-api – 认证/授权MVC 5和Web API –
- 在Asp.net Gridview中显示多列中的行
- asp.net – 以编程方式将CSS类添加到ListItem
- asp.net – 什么原因导致“无法注销UpdatePanel”
- asp.net-mvc – Web Deploy/Publish正在添加一个
- asp.net-mvc – HttpContext和HttpContextWrappe
- ASP.NET成员资格创建用户,而不需要QuestionAndAn
- asp.net-mvc – 如何使用Visual Studio 2013和En
- asp.net-mvc-3 – 此版本的SQL Server不支持没有
热点阅读
