0

I have implemented code(Elmah Everywhere) to catch Unhandled exception in Silverlight-4 as given in following link

https://github.com/vincoss/vinco-logging-toolkit.

I have also downloaded code sample form link but, I am not able to find the place where unhandled exceptions are stored.

I have implemented Elmah in asp.net and in which we can generally see all unhandled exceptions on domainname/elmah.axd (as given in web.config).

Please help me in finding place where all unhandled exceptions get stored in silverlight.

Or can any one suggest me any library which can achieve same thing .

Thanks in advance

Dnyanesh
  • 2,265
  • 3
  • 20
  • 17

1 Answers1

2

Exceptions that are raised in Silverlight are stored in the database. Please check documentation how to configure Silverlight exception handling.

You can find the database in project folder “Vinco.Elmah.Everywhere\Source\ErrorWebSite\App_Data\ Elmah.Everywhere.mdf”

Attach this database to your MS SQL Server.

Elmah.Everywhere codebase was recently updated with new functionality and better samples.

Please try to run samples and then browse logged error on this

URL: http://localhost:11079/elmah

NOTE: Elmah.Everywhere log is designed to log errors to a remote site. To get full benefits of Elmah.Everywhere log create a web site or use existing “ErrorWebSite” from samples where errors will be logged. This allows you to have multiple projects that logs errors into central database. Just change ApplicationName in ExceptionDefaults to distinguish between different projects.

Sample Silverlight configuration

You can configure error logging as indicated in the following example.

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

In Application constructor call handler setup method.

public App()
{
    SetUpExceptionHandler();
}

Add handler log into Application_UnhandledException method

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

This configuration will be logging errors against Silverlight host URL. Ensure that you have Elmah.Everywhere.dll, Elmah.dll in bin folder and also configuration details in Web.config file.

To view errors in browser see “ErrorWebSite” sample. URL should look like this. http://yourdomain.com/elmah

For more information please see provided samples.

Feross
  • 121
  • 2