How can a newly added global.asax file make a mess of my WCF service
Asked Answered
I

2

0

I have a silverlight app that uses WCF both by polling Duplex and "normal" async calls. everything was working fine, until I added a global.asax file.

After an hour of googling, I came across this rather dated blog by Jean-Dirk Stuart that suggested commenting out the stubbed Session_start event.

Sure enough that corrected the problem, but it raises a concern. Why would this seemly benign member of the global.asax file break the wcf calls.

Impostume answered 10/12, 2010 at 18:36 Comment(0)
A
2

Yeah, this is a little known but annoying issue. The problem comes down to session state being enabled once you add a global.asax file to your web project. Once session state is enabled, the server will only execute the calls sequentially. Here are two articles with some more in-depth information:

http://blogs.msdn.com/b/silverlightws/archive/2009/09/30/having-a-pollingduplex-service-and-any-other-wcf-service-in-the-same-website-causes-silverlight-calls-to-be-slow.aspx

http://weblogs.asp.net/olakarlsson/archive/2010/05/20/simultaneously-calling-multiple-methods-on-a-wcf-service-from-silverlight.aspx

This behaviour only occurs when using the browser networking stack, so your options are:

  1. Disable session state in your web project, or
  2. Use the client networking stack

Hope this helps...

Chris

Adust answered 11/12, 2010 at 6:19 Comment(1)
Very interesting. I don't need session state, but I need to spool up a background thread to monitor an event queue and send messages to the SL clients via duplex. I had expected to use the Global.asax application_start event to get this done. Perhaps there's a better way?Impostume
P
0

There are some types of binding which support accessing asp.net session data, I really dont see how it would affect unless WCF tries to hook into the session_start event just like a http module does. You could also use reflector to disassemble the code where you where getting the exception.

Peeling answered 10/12, 2010 at 20:50 Comment(1)
That's the point, I think... if you add global.asax and/or set your WCF service to asp.net compatibility mode, wcf calls trigger session_start (etc)Altonaltona

© 2022 - 2024 — McMap. All rights reserved.