有时 Silverlight 中的 RIA 域服务/上下文调用会失败
我有一个非常奇怪的问题:我正在使用 RIA 服务开发 Silverlight 业务应用程序。
我在服务器端有一些 DomainServices,其中之一我遇到了问题,有时调用其中一种方法会失败(在 SL 客户端上,我收到“NotFound”异常,并且请求没有到达服务器(我在域服务的构造函数中放置了一个断点)!
更奇怪的是:
- 如果 SL 客户端的调用失败,那么我启动 Fiddler2,然后启动第二个(或任何连续的)呼叫正在工作如果我关闭 fiddler,它会再次变得不稳定。
- 如果我重命名我想调用的方法(通过重构),也在 SL 客户端的上下文中调用重命名的方法,那么每次我调用它都会成功!
这是我的可疑方法:
[Invoke]
public void RegisterTrainingProgramCompletion(bool isCompleted, int result, string sportsManNote)
{
//...
}
如果我将此方法重命名为“RegisterTpCompletion”,那么它会起作用(令人难以置信)
DomainService 标记有一些属性:
[EnableClientAccess()]
[RequiresAuthentication()]
public class NextTrainingProgramDomainService : DomainService
我设法以某种方式记录服务器端,并从WCF 堆栈:
从网络接收的 XML 存在问题。有关更多详细信息,请参阅内部异常。在 System.ServiceModel.Channels.HttpInput.DecodeBufferedMessage(ArraySegment`1 缓冲区,流 inputStream) 在 System.ServiceModel.Channels.HttpInput.ReadBufferedMessage(Stream inputStream) 在 System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception& requestException) 在 System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext 上下文,操作回调) 在 System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult 结果) 在 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() 在 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() 在 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(对象状态) 在 System.ServiceModel.AspNetPartialTrustHelpers.PartialTrustInvoke (ContextCallback 回调,对象状态) 在 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequestWithFlow(对象状态) 在 System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode,UInt32 numBytes,NativeOverlapped * nativeOverlapped) 在 System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 错误,UInt32 bytesRead,NativeOverlapped* nativeOverlapped) 在 System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode,UInt32 numBytes,NativeOverlapped * pOVERLAP)
那么,由于某种未知的原因,clint(SL-app)无法正确刷新请求?我开始担心:(((
我的呼叫者(SL 客户端)通过自定义表单身份验证进行身份验证。
我知道你可能会说,就这样吧,但这让我发疯,我想知道问题是什么,所以我不会再遇到它了,
!
谢谢 恰比
I have a very strange problem: I'm developing a Silverlight business application with RIA services.
I have some DomainServices on the server-side, and with one of them I'm having the problem, that sometimes calling one of the methods fails (on the SL client, I get "NotFound" exception, and the request doesn't event arrive to the server (I put a breakpoint into the constructor of the domainservice)!
What makes things strange even more:
- If the call fails from the SL client, then I start Fiddler2, then the second (or any consecutive) call is working properly! If I close fiddler, it becomes unstable again.
- If I rename the method which I would like to call (via refactor), call renamed method on the context at SL client side too, then everytime I make the call it is successful!
Here is my suspicios method:
[Invoke]
public void RegisterTrainingProgramCompletion(bool isCompleted, int result, string sportsManNote)
{
//...
}
If I rename this method to "RegisterTpCompletion", then it works (unbelievable)!
The DomainService is marked with some attributes:
[EnableClientAccess()]
[RequiresAuthentication()]
public class NextTrainingProgramDomainService : DomainService
I managed to somehow log the server-side, and got the following exception from the WCF stack:
There is a problem with the XML that was received from the network. See inner exception for more details. at System.ServiceModel.Channels.HttpInput.DecodeBufferedMessage(ArraySegment`1 buffer, Stream inputStream)
at System.ServiceModel.Channels.HttpInput.ReadBufferedMessage(Stream inputStream)
at System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception& requestException)
at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback)
at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
at System.ServiceModel.AspNetPartialTrustHelpers.PartialTrustInvoke(ContextCallback callback, Object state)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequestWithFlow(Object state)
at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
So for some unknown reason the clint (SL-app) does not flush properly the request? I'm starting to worry :(((
My callers (SL client) are authenticated with custom forms authentication.
I know you could say, leave it then as it is, but this drives me crazy, I want to know what's the problem, so I do not run into it again.
Thanks!
Bye,
Csabi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我怀疑是URL问题,大多数URL只能有几kb长。现在我不知道大小,但在 RIA 服务中,它使用 URL 将过滤器作为查询字符串发送。
而且你的方法的名称也很大,已经达到了 URL 的最大限制。当它甚至与大名字一起工作时,您的过滤器部分可能是空的,但如果您添加更多过滤器,您将面临错误。
I suspect it is URL issue, mostly URL can only be few kbs long. Now I don't know the size but in RIA services, it uses URL to send your filter as querystring.
And names of your method are also big, it is reaching max limit of URL. When it is working even with big name your filter part may be empty but if you add more filters you will face errors.