json反序列化失败时如何调试WCF? [英] How to debug WCF when json deserialize fail?

查看:135
本文介绍了json反序列化失败时如何调试WCF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个RESTful服务,但在MONO中似乎有问题.

I've a RESTful service, but it seems buggy in MONO.

在.NET中,当我粘贴无效的帖子格式(例如缺少Content-Type或无效的json正文格式)时,它将引发异常并等待下一个请求.但是在MONO中,它抛出未处理的异常并下降,我的意思是,它完全退出了.这可能是致命的攻击.

In .NET, when I past it a invalid post format, such as missing Content-Type or invalid json body format, it throw an exception and wait for next request. But in MONO, it throw unhandle exception and go down, I mean, it completely quit. This can be a fatal attack.

不幸的是,我不知道如何调试它,这在我编写的代码中不会发生.

Unfortunately, I have no idea about how to debug it, it ain't happens on codes I wrote.

有什么建议吗?如何避免它或捕获此异常? 谢谢!

Guys any advice?? How to avoid it or catch this exception? Thank you!

CLI主机.

界面

提琴手张贴的格式错误

然后服务关闭:(

推荐答案

有了 @knocte 的提示,我最终做到了.

With @knocte provided clue, I make it eventually.

这似乎是一个固定的错误,但Xamarin表示不再对旧版本进行修补.

This seems a fixed bug, but Xamarin said old version will not be patched any more.

我要做的是升级到mono3.2( https://github.com /mono/mono/tree/mono-3-2 ),现在mono可以处理该异常并且不会退出.

What I do upgrade to mono3.2 (https://github.com/mono/mono/tree/mono-3-2), now mono can handle that exception and ain't quit.

此外,您可能希望使用monoDevelop( https://github.com/mono/monodevelop/tree/monodevelop-4.1.7-branch )

Further, you may want rebuild program with monoDevelop (https://github.com/mono/monodevelop/tree/monodevelop-4.1.7-branch)

再次感谢@knocte,请发表您的线索作为答案,以便我投票;]

Thanks @knocte again, please post your clue as answer so I can vote it up ;]

P.S:ubuntu apt-get无法使用当前版本的mono/MD,因此您可以在上面克隆/制作它们,它可以工作.并且请注意,我使用的MD并非边缘一出血,您可以切换到较新的分支:]

P.S: Current version of mono/MD is NOT available for ubuntu apt-get, so you may clone/make them above, it works. And please notice that MD I use is NOT bleed edge one, you may switch to newer branch :]

这篇关于json反序列化失败时如何调试WCF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆