IIS hosted WCF blocks access to session object

  • Thread starter Thread starter mabra
  • Start date Start date
M

mabra

Hi !

I have a WCF [hosted in IIS], that has two methods, which both will be
called - one after the other - on a click by a ajax client. The first method
is
a method with long duration, the second method is a method with short
duration. Both calls terminate "at the same time". So, the call with the long
duration blocks the short call. Only one request from the same client can be
processed at the same time.

This is completely inacceptable. I added the interface
"IReadOnlySessionState" to the wcf service [no host declaration exists!!] and
used "ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple,
InstanceContextMode=InstanceContextMode.PerCall)". Nothing is of any help.

So, my resume:WCF is a bad decision to use with ajax.

If session handling on the asp(x) is disabled, everything works like
expected. But I need the seeion handling, so I tried the readonly attribute.


Or:Do I miss something????

Thanks a lot.

br--mabra
 
mabra said:
Hi !

I have a WCF [hosted in IIS], that has two methods, which both will be
called - one after the other - on a click by a ajax client. The first
method
is
a method with long duration, the second method is a method with short
duration. Both calls terminate "at the same time". So, the call with the
long
duration blocks the short call. Only one request from the same client can
be
processed at the same time.

This is completely inacceptable. I added the interface
"IReadOnlySessionState" to the wcf service [no host declaration exists!!]
and
used "ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple,
InstanceContextMode=InstanceContextMode.PerCall)". Nothing is of any help.

So, my resume:WCF is a bad decision to use with ajax.

If session handling on the asp(x) is disabled, everything works like
expected. But I need the seeion handling, so I tried the readonly
attribute.
Or:Do I miss something????

So why can't you use a async WCF Web service to make the calls to the
methods, which would be independent from each other?


__________ Information from ESET NOD32 Antivirus, version of virus signature database 4302 (20090803) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
Hi !

Much thanks for your reply! Sorry, I am late ....don't saw it
before ...

From your answer, I see, it might be, I have mis-described the
scenario.

The client has two buttons, each one calling one WCF method
asynchronously, both are async ajax request.
If the first called method is the long running method, both calls
returns ~nearly at the same time. Means:One
executing WCF method blocks executing the other one.

I rewrote the WCF service as a webservice [asmx], deriving the service
class from interface "IReadOnlySessionState", both calls are running
parallel and so, the short calls returns immidiately.

I tried to use "IReadOnlySessionState" on the WCF service also, but
this has no effect.

Do you possibly know a solution?
I have not understand, what you meant with "async WCF" service!??

Thanks a lot!

br--mabra

I have a WCF [hosted in IIS], that has two methods, which both will be
called - one after the other - on a click by a ajax client. The first
method
is
a method with long duration, the second method is a method with short
duration. Both calls terminate "at the same time". So, the call with the
long
duration blocks the short call. Only one request from the same client can
be
processed at the same time.
This is completely inacceptable. I added the interface
"IReadOnlySessionState" to the wcf service [no host declaration exists!!]
and
used "ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple,
InstanceContextMode=InstanceContextMode.PerCall)". Nothing is of any help.
So, my resume:WCF is a bad decision to use with ajax.
If session handling on the asp(x) is disabled, everything works like
expected. But I need the seeion handling, so I tried the readonly
attribute.
Or:Do I miss something????

So why can't you use a async WCF  Web service to make the calls to the
methods, which would be  independent from each other?

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4302 (20090803) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com- Hide quoted text -

- Show quoted text -
 
mabra said:
Hi !

Much thanks for your reply! Sorry, I am late ....don't saw it
before ...

From your answer, I see, it might be, I have mis-described the
scenario.

The client has two buttons, each one calling one WCF method
asynchronously, both are async ajax request.
If the first called method is the long running method, both calls
returns ~nearly at the same time. Means:One
executing WCF method blocks executing the other one.

<http://en.wikipedia.org/wiki/Windows_Communication_Foundation>

<copied>

WCF also supports non-blocking (asynchronous) calls between client and
service, via several mechanisms.

Do you possibly know a solution?
I have not understand, what you meant with "async WCF" service!??


You can go to the WCF WEB service reference on the client-side project,
the Web Service itself.

You right-click the Web service and select "Configure Service Reference".

You check mark enable "Generate asynchronous Operations" and click the
OK button.

You recompile the client-side project.

After the recompile of the project, it will generate the new methods for
the client-side the WCF Web service reference for sync and async calls
to the same methods of the service contract.


var client = new wcfwebservice();

client.DoSomething(); // sync call to the method.
client.close();

client.DoSomethingAsync(); // the async call to DoSomething()
client.close();

There is also a DoSomethingCompleted(), too.

You may have to use IWCFservice, WCFservice.svc and WCFservice.svc.cs
with [Operational Contract] attribute.
 
Back
Top