我已经实现了代码(Elmah Everywhere)来捕获Silverlight-4中未处理的异常,如下所示
https://github.com/vincoss/vinco-logging-toolkit。
我还下载了代码示例表单链接,但是,我无法找到存储未处理异常的地方。
我在asp.net中实现了Elmah,在其中我们通常可以看到domainname/elmah.axd上所有未处理的异常(如web.config中给出的)。
请帮助我找到所有未处理的异常都存储在silverlight的地方。
或者有人能建议我任何一个图书馆,可以实现同样的事情。
提前感谢
发布于 2012-07-26 13:32:24
在Silverlight中引发的异常将存储在数据库中。请检查文档如何配置Silverlight异常处理。
您可以在项目文件夹“Vinco.Elmah.Everywhere\Source\ErrorWebSite\App_Data\ Elmah.Everywhere.mdf中找到数据库“
将此数据库附加到。
Elmah.Everywhere代码库最近更新了新功能和更好的示例。
请尝试运行示例,然后浏览此示例上的日志错误。
网址:http://localhost:11079/elmah
注意: Elmah.Everywhere日志旨在将错误记录到远程站点。为了充分利用Elmah.Everywhere日志,创建一个网站,或者使用将记录错误的示例中现有的“ErrorWebSite”。这允许您有多个将错误记录到中央数据库的项目。只需更改ExceptionDefaults中的ExceptionDefaults以区分不同的项目.
示例Silverlight配置
如下面的示例所示,可以配置错误日志记录。
private static void SetUpExceptionHandler()
{
Uri uri = Application.Current.Host.Source;
string currentHost = string.Format("{0}{1}{2}:{3}", uri.Scheme, Uri.SchemeDelimiter, uri.Host, uri.Port);
// Configure
var writter = new ClientHttpExceptionWritter
{
// NOTE: Possible to pass URI by startup arguments.
RequestUri = new Uri(string.Format("{0}/error/log", currentHost), UriKind.Absolute)
};
var defaults = new ExceptionDefaults
{
Token = "Silverlight-Test-Token",
ApplicationName = "Silverlight-Sample",
Host = string.Format("{0}{1}{2}:{3}", uri.Scheme, Uri.SchemeDelimiter, uri.Host, uri.Port)
};
ExceptionHandler.Configure(writter, defaults);
}中的应用程序构造函数调用处理程序设置方法.
public App()
{
SetUpExceptionHandler();
}将处理程序日志添加到Application_UnhandledException方法中
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
ExceptionHandler.Report(e.ExceptionObject, null);
}此配置将记录针对Silverlight主机URL的错误。确保在bin文件夹中有Elmah.Everywhere.dll、Elmah.dll以及Web.config文件中的配置详细信息。
若要查看浏览器中的错误,请参阅“ErrorWebSite”示例。URL应该是这样的。http://yourdomain.com/elmah
有关更多信息,请参阅提供的样本。
https://stackoverflow.com/questions/10765083
复制相似问题