WCF RIA 服务和Silverlight:自定义异常消息 + x 的加载操作失败
因此,在服务器上,我发回自定义异常消息,旨在向用户显示(认为“错误的用户名/密码”、“帐户已被锁定”等)
但是,当我在 silverlight 中查看异常消息时,它带有前缀与“x 的加载操作失败”。我认为 Exception.InnerException 是放置原始异常的好地方,但我猜 RIA 团队不同意。
有没有办法获取我原来的异常消息?当然,我可以编写一个快速的正则表达式来解析它,但这感觉很脏......这是我唯一的选择吗?
So on the server I send back custom exception messages, meant to be displayed to the user (think "Bad Username/Password", "Account has been locked out" etc.)
However, when I view the Exception message in silverlight it is prefixed with "Load operation failed for x." I was thinking that Exception.InnerException would be a good place to put the original Exception, but I guess the RIA team didn't agree.
Is there a way to get my original exception message? Sure, I could write a quick regex to parse it out, but that feels dirty... Is that my only option?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我读到了一个可能适合您的解决方案。不过我自己还没有实现它。
http://mark. mymonster.nl/2011/02/10/make-use-of-wcf-faultcontracts-in-silverlight-clients/
I read about a solution that may work for you. I have yet to implement it myself though.
http://mark.mymonster.nl/2011/02/10/make-use-of-wcf-faultcontracts-in-silverlight-clients/