English 中文(简体)
ELMAH 各地 -- -- 银光 4
原标题:ELMAH Everywhere - Silverlight 4

我实施了代码(艾玛(Elmah everywhere)) 以捕获银灯-4未处理的例外情况,如以下链接中给出的

https://github.com/vincos/vinco-log-toolkit

我还下载了代码样本格式链接,但是,我找不到存放未处理的例外情况的地方。

我已在Asp.net中应用了Elmah, 在域名/elmah.axd(如 Web. config中给出的)上,

请帮助我找到一个地方 将所有未处理的例外 都储存在银光中

或任何人可以建议我 任何图书馆 能够实现同样的事情。

提前感谢

问题回答

Silverlight 中出现的例外存储在数据库中。 请检查文件如何配置 Silverlight 例外处理 。

您可以在“ Vinco. Elmah. everywhere sourceErrorWebSiteApp_Data Elmah. everywhere.mdf”的项目文件夹中找到数据库。

此数据库附加到您的 MS SQL 服务器 。

Elmah. 每一个代码库最近都更新了 新的功能和更好的样本

请尝试运行样本, 然后浏览登入错误

網址:http://localhost:11079/elmah

NOTE: Elmah. 每个日志的设计都是为了将错误登录到远程站点。 要获得 Elmah 的全部好处。 每个日志都创建网站, 或者使用样本中存在的“ 错误WebSite ”, 错误将被登录到中央数据库中。 这样可以让您拥有多个项目, 将错误登录到中央数据库中。 只需在例外 Defaults 中更改应用程序名称, 以区分不同的工程 。

<强度 > 银光样本配置

您可以配置以下示例所示的错误记录。

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);
}

<% 1> 应用程序构建器呼叫处理器设置方法 。

public App()
{
    SetUpExceptionHandler();
}

< 加强> Add 处理器登录到 应用程序- unhandled Devition 方法

private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
    ExceptionHandler.Report(e.ExceptionObject, null);
}

此配置将会对 Silverlight 主机 URL 进行记录错误 。 确保您有 Elmah. everywhere. dll 和 Elmah. dll 在文件夹中, 并在 Web. config 文件中有配置细节 。

要查看浏览器中的错误, 请查看“ 错误WebSite” 样本 。 URL 应该这样看 。 < a href=> http:// ourdomain.com/ elmah" rel = “ no follow” > http://ourdomain. com/ elmah

详情请见所提供的样本。





相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签