How to handle WCF service error in Silverlight when session authentication timeout

I have a WCF service that I am accessing in Silverlight. Silverlight application requires authentication (authentication occurs when a service is called.)

I noticed that when the authenticated session ends, and the user does something on the side of the application that will make the call to this service, the application simply freezes, waiting for a response from the service. My service is designed to throw an exception in these cases, however, nothing is assigned on the Silverlight side, and an exception occurs instead:

CommunicationException was not handled by user code

The remote server returned an error: NotFound.

In my maintenance methods, I check if the user is still checked, and if so, I continue the operation. If not, I assign a value to the output parameter (of type Exception). On the Silverlight side, I check to see if this exception is null, and otherwise take appropriate action. When I execute, the out parameter gets the correct exception, but then Silverlight throws the exception above (in Reference.cs) before it even gets to the point where I can handle it ...

Has anyone else seen this? Any suggestions?

. , , , . - Exception ( System.Exception)

+3
5

:

WCF- , , ?

WCF Silverlight, ?

WCF Silverlight? , . , , .

0
0

-, , , : WCF Silverlight

, Silverlight 400 , , .

, , , , , . , ... - ?

0

:

Random "Not Found" Silverlight - ASP.NET

asmx, WCF. WCF silverlight. 404 .

0

WCF, , (. http://msdn.microsoft.com/en-us/library/dd470096(VS.95).aspx), - 404 - , .

, 2 :

  • WCF, , .
  • WCF, , App.xaml.cs:

    HttpWebRequest.RegisterPrefix( "https://", WebRequestCreator.ClientHttp); HttpWebRequest.RegisterPrefix( "http://", WebRequestCreator.ClientHttp); `

, Silverlight, 404.

Obviously, the transition to the client’s network stack has its drawbacks (for example, you will have to process authentication, caching, cookies yourself)

-1
source

Source: https://habr.com/ru/post/1732371/


All Articles