Error logging from Silverlight

95 views
Skip to first unread message

Guillaume Jay

unread,
Sep 30, 2009, 11:45:53 AM9/30/09
to ELMAH
Hi

I'm trying to use elmah (xml storage) to log errors from my
Silverlight client.
So, I made a WCF service, which is used by my client when an
unattended exception is raised.
This is my DataContract :
public class SilverlightErrorData
{
[DataMember]
public string Message { get; set; }
[DataMember]
public string StackTrace { get; set; }
[DataMember]
public string CustomData { get; set; }
}

The wcf service then use Elmah.ErrorLog.GetDefault
(HttpContext.Current).Log(new Exception([text made from the data in
the above contract])) to log the error.
It works well enough for the urgent debugging need i have, but I'm not
totally satisfied :
1) in the WCF function, HttpContext.Current is always null. I can't
also use Elmah.ErrorSignal.FromCurrentContext().Raise(). That must be
normal, even if I can find people using it with WCF
( http://will.hughesfamily.net.au/20090505/making-wcf-and-elmah-play-nice-together/
)
2) the elmah log is not very nice. For example, the message and the
detail field are the same, whereas I'd like the stacktrace to be only
in the xml detail field. Is there a way to do that ?

I'm thinking about generating by myself an ELMAH xml log file, but it
seems dirty. Is there a better solution ?

Thanks,

Atif Aziz

unread,
Sep 30, 2009, 3:57:09 PM9/30/09
to el...@googlegroups.com
1) in the WCF function, HttpContext.Current is always null. I can't
also use Elmah.ErrorSignal.FromCurrentContext().Raise().
 
Did you enable ASP.NET compatibility mode? See section, "Hosting WCF Services in ASP.NET Compatibility Mode," of article, "WCF Services and ASP.NET," for more:
 
 
You will need to add this to your configuration:
 
<system.serviceModel>       
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
the message and the
detail field are the same, whereas I'd like the stacktrace to be only
in the xml detail field.
 
Not sure what you're exactly after here. Care to rephrase or expand?
 
- Atif

Guillaume Jay

unread,
Oct 2, 2009, 8:28:05 AM10/2/09
to ELMAH
> Did you enable ASP.NET compatibility mode? See section, "Hosting WCF

No, I never heard of this, thanks.

> Not sure what you're exactly after here. Care to rephrase or expand?

I'll to make a screenshot, it would be far easier :)

I tried to send directly my client exception object through WCF from
silverlight to the website, but I think it's not possible.

Guillaume
Reply all
Reply to author
Forward
0 new messages