我使用企业库5.0与SharePoint登录异常转换SQLdatabase.I使用Windows 7操作系统和Visual Studio 2010中例外策略与数据库跟踪侦听器在企业图书馆5.0没有记录异常到SQL数据库
(1)如链接中所示,我通过在位置(C:\ Documents and Settings \ Venkatesan \ My Documents \ EntLib50Src \ Blocks \ Logging \ Src \ DatabaseTraceListener \ Scripts \ CreateLoggingDb)中运行脚本在SQLEXPRESS中创建了“日志记录”数据库
(2)我打开企业库(EntLib Config .Net 4)中的web.config文件,并提到连接字符串为“data source =。\”的数据库实例(ExampleDatabase)的连接字符串。 (3)我提到了异常策略(MyPolicy),异常类型(All Exceptions),数据库跟踪监听器等等。(3)SQLEXPRESS;集成安全性= SSPI; AttachDBFilename = | DataDirectory | \ Logging.mdf;用户实例= true
上..因此web.config文件如下: 我已经在web.config文件
仅设置所需的部分.. .. .. .. .. (4)我部署所需的DLL在GAC和Web应用程序的bin以及... 以前,我没有在GAC中部署ent lib DLL,但是我有一个错误提到我必须在GAC中部署它们。
(5)我在解决方案项目中添加了ent lib dlls作为参考。
(6)我的项目代码如下:使用系统
;
使用Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Data.SqlClient;
using Microsoft.Practices.EnterpriseLibrary.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
使用Microsoft.Practices.EnterpriseLibrary.Data。SQL;
using Microsoft.Practices.EnterpriseLibrary.Data.SqlCe;
using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling;
using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging;
使用Microsoft.Practices.EnterpriseLibrary.Logging;
using Microsoft.Practices.EnterpriseLibrary.Logging.Database;
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.ObjectBuilder2;
使用Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;
using Microsoft.Practices.Unity.InterceptionExtension;
using Microsoft.Practices.Unity.InterceptionExtension.Configuration;
using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration;使用Microsoft.Practices.EnterpriseLibrary.Logging.Configuration;
命名空间MyEntLibProj.Layouts.MyEntLibProj
{
公共部分类MyApplicationPage:LayoutsPageBase
{
保护无效的Page_Load(对象发件人,EventArgs的)
{
尝试
{
抛出新ArgumentNullException (“这是一个错误!!!!”);
}
catch(Exception ex)
{
Exception ex1;
bool result = ExceptionPolicy.HandleException(ex,“MyPolicy”,out ex1);
if(result)
throw;
}
}
}
}
当我调试代码,虽然我没有得到任何异常,“结果”值是true,则ArgumentNull异常不获取登录到我database.Please帮助我找到了,我会一直错了...