Concurrent calls in WCF RIA not working - wcf-ria-services

We are using Silverlight 4.0 with WCF RIA services.
One thing we noticed is that we are not able to make simultaneous service calls to the server.
Our WCF RIA service have 2 methods method1 and method2. What we noticed is that, the calls are sequential, i.e method2 is not executed until method1 comes back.
Do we need to change any configuration in the web config to make simultaneous calls work ?
Thanks !

I had the same problem and I resolved swithing that calls on the ClientStack.
Here ther's a long and clear explanation on what happens!
Hope this helps!

Related

OSGi: What happens when an imported service is stopped while the service is still running

Say I am using a service A which is imported in another service B. While B is running normally(ofcourse A is Active), what will happen is service A is uninstalled while service B is still running?
Service A -> Service B
What will be the different scenarios in case I am using ServiceReference, ServiceTracker & DS?
When a service is unpublished in OSGi, an event is sent to all bundles currently using that service to tell them that they should stop using it.
If you are using DS, your unbind method will be called. When it is called, you should make best efforts to stop using the service as soon as possible. But ultimately OSGi is a cooperative system, it cannot force you to release the service. However if you don't then you can cause problems, for example the service publisher will not be fully garbage-collected. You end up sabotaging the dynamics of the OSGi platform, possibly creating memory leaks and so on.
If you are using ServiceTracker then the removedService method will be called, and you need to respond in the same way. But didn't I tell you in the other question not to use ServiceTracker?? ;-)
If you are using ServiceReference then you need to explicitly register a ServiceListener in order to receive these events. This is why you really really shouldn't use this low-level API until you have gained a lot more experience (and once you do have that experience, you won't want to use it anyway!).
First of all: one of the advantages of OSGi is that the behaviour of the framework and standard services are clearly specified. Those specifications can be downloaded from the OSGi Alliance web site, or, if you don't like reading PDFs, ordered for print. The question you are asking is perfectly answered in those specifications.
That said, in summary: when a service is unregistered:
The ServiceReference object remains as it is. However, a call to ServiceReference.getService() will return null. Note that when using ServiceReferences you should release any references to the actual service object as retrieved via getService(), this normally requires some kind of tracking of the service.
For ServiceTracker ServiceTracker.remove is called. This normally results in a call to removedService() on the ServiceTracker or the defined ServiceTrackerCustomizer.
For DS, the defined unbind method for the referenced service is called (if specified). Furthermore, if the cardinality for the used service indicates that the service is mandatory, the using service may also be unregistered, even possibly deactivated or a new instance activated depending on the availability of alternative services and the policy defined for the service.

Entity Framework - closure of Object Contexts

After using EFProfiler (absolutely fantastic tool BTW!) for profiling a few of our Entity Framework applications, it seems that, in most cases, all of the Object Contexts are not closed.
For example, after running it locally, EF Profiler told me that there were 326 Object Context's opened, yet only 1 was closed?
So my question is, should I worry about this? Or is it self-contained within Entity Framework?
If you're not using an IoC container is there anyway you can close the ObjectContexts manually after each request, for example in the End Request of your Global.asax, thereby simulating a "per request" lifestyle for your contexts?
ObjectContexts will be disposed eventually if your application is not holding onto them explicitly, but in general, you should try to dispose them deterministically as soon as possible after you are done with them. In most cases, they will hold onto database connections until they are disposed. In my current web application, we use an IoC container (Autofac) to ensure that any ObjectContext opened during a request is disposed at the end of the request, and does not have to wait for garbage collection.
I suggest you do worry about it and try to fix the issue as Object Contexts are pretty "bulky". If you have too many of them your application may eventually end up using more memory than it needs to and IIS will be restarting your application more frequently then...

IOS 5 Application Updates in separate thread

I'm creating an app that needs to be updated periodically (for chats, notifications, contact detail changes, etc). Xcode 4.2 IOS 5
I'm using sudzc generated code to consume the webservices. Those method calls are async as expected. I thought i could call all the update webservices within an NSOperation. However, i've discovered that the lifetime of an NSOperation is too short for any handler methods to be called. I've seen some "solutions" to that problem...but none them use the sudzc soap client generated classes. I also need to call the set of webservices periodically (like every 10 or so seconds).
So basically i need to call the webservices periodically and in a separate thread from the main thread. I'll also need to use the return values to update UI's.
Can someone please give me some advice.
Thanks :)

SSL: Broken pipe accesing SOAP service with PHP's SoapClient

I have a SOAP WS which I access through PHP's SoapClient (wrapped with Zend Framework's Soap Client). The webservice runs through https, and the calls take quite some time (a few minutes each).
I am making 4 calls, one after another through the same instance of SoapClient. However, after some time running, and at a random point (not allways on the same method call) I see the following error:
Warning: SoapClient::__doRequest(): SSL: Broken pipe in pathtomyfile
I still have no idea why this happened, but I've got some extra insight and a workaround.
The issue arises when, after a SOAP call that took really long to run, I try to use the same connection for another request. The first one will succeed, but upon the new call, the error raises.
This means, that as long as you don't NEED the connection to be same (which is usually the case on SOAP web services), you can just reset the connection between calls. Not the most efficient use of resources, but will work flawlessly.
I found that adding the
'keep_alive' => false
option to
new SoapClient($url, $options)
solved the issue for me.
There is a related bug report here but very little documentation about it apart from that: https://bugs.php.net/bug.php?id=60329

How to use a WF DelayActivity in an ASP.Net web based workflow

I have a web application that I am adding workflow functionality to using Windows Workflow Foundation. I have based my solution around K. Scott Allen's Orders Workflow example on OdeToCode. At the start I didn't realise the significance of the caveat "if you use Delay activities with and configure active timers for the manual scheduling service, these events will happen on a background thread that is not associated with an HTTP request". I now need to use Delay activities and it doesn't work as is with his solution architecture. Has anyone come across this and found a good solution to this? The example is linked to from a lot of places but I haven't seen anyone else come across this issue and it seems like a bit of a show stopper to me.
Edit: The problem is that the results from the workflow are returned to the the web application via HttpContext. I am using the ManualWorkflowSchedulerService with the useActiveTimers and this works fine for most situations because workflow events are fired from the web app and HttpContext still exists when the workflow results are returned and the web app can continue processing. When a delay activity is used processing happens on a background thread and when it tries to return results to the web app, there is no valid HttpContext (because there has been no Http Request), so further processing fails. That is, the webapp is trying to process the workflow results but there has been no http request.
I think I need to do all post Delay activity processing within the workflow rather than handing off to the web app.
Cheers.
You didn't describe the problem you are having. But maybe this is of some help.
You can use the ManualWorkflowSchedulerService with the useActiveTimers and the workflow will continue on another thread. Normally this is fine because your HTTP request has already finished and it doesn't really matter.
If however you need full control the workflow runtime will let you get a handle on all loaded workflows using the GetLoadedWorkflows() function. This will return acollection of WorkflowInstance objects. usign these you can can call the GetWorkflowNextTimerExpiration() to check which is expired. If one is you can manually resume it. In this case you want to use the ManualWorkflowSchedulerService with the useActiveTimers=false so you can control the last thread as well. However in most cases using useActiveTimers=true works perfectly well.