WCF proxy singleton in multithreaded app

I have just inherited an asp.net mvc 3 site operating on .net 4 which makes heavy use of WCF calls to a very slow external service. The site is not yet live.

One curious piece of code I've found is around the WCF client proxy usage. There is one instance created for the entire aspnet application which is shared between all threads. So, effectively a global variable.

To me, this screams danger yet the site operates without error even under load testing. There is no guard code preventing concurrent calls on the WCF client in the site.

Can someone confirm the safety of using what is essentially a singleton WCF proxy in an asp net app? Wouldn't faulting kill the proxy for all threads?


Can someone confirm the safety of using what is essentially a singleton WCF proxy in an asp net app? Wouldn't faulting kill the proxy for all threads?

The proxy is thread safe but as you say, it should be handled with care because it could be in a faulted state in which case the channel should be opened again. You may take a look at the following sample implementation that I have been using to reuse the same channel factory. What is expensive is the creation of the channel factory, not the channel itself.

Category:wcf Time:2012-02-02 Views:0

Related post

  • using wcf proxy project instead of app.config files for each client 2010-06-20

    I have created several WCF services. In order to avoid adding service references in each and every one of my client projects I've created a proxy project which contains all service references and that every project can use as a dll reference. problem

  • WCF proxy Client Singleton Pattern Performance 2011-12-15

    Is it better, performance wise, to design a Proxy Client in WCF with singleton pattern, or each time create the object and close it after the call? --------------Solutions------------- Depends. We had this problem recently and because we were needing

  • How to create a Singleton WCF proxy using Structuremap 2012-04-25

    In WCF, creating a proxy is a heavy operation, so if you are experiencing performance slowdown you should definitely look at this area. One of the possible solutions to tackle this problem is to reuse your proxies across your application threads, eit

  • Silverlight WCF Proxy async only? 2009-08-17

    Why do the Silerlight-generated WCF proxy class(es) offer only async calls? There are cases where I don't really need the async pattern (for example in a BackgroundWorker) EDIT : Sometimes I need to process the results of two WCF calls. It would have

  • How to implement WCF proxy pooling? 2009-09-16

    What is the best practice around implementing WCF proxy pooling? What precautions should be taken in the design? Any pointers in this direction is greatly appreciated. --------------Solutions------------- If you want to go down that path, from Perfor

  • Castle Windsor XML configuration for WCF proxy using WCF Integration Facility 2010-04-23

    Currently, we use programming registration of WCF proxies in Windsor container using WCF Integration Facility. For example: container.Register( Component.For<CalculatorSoap>() .Named("calculatorSoap") .LifeStyle.Transient .ActAs(new DefaultClie

  • Custom lifetime management in DI containers (wcf proxy: Unity vs Castle Windsor) 2010-07-06

    I've found nice post: Singleton WCF Proxy. It is about the implementation of WCF proxy life scope using Castle Windsor DI container. Implementation of the abstract class AbstractLifestyleManager from Castle.MicroKernel.Lifestyle namespace overrides 3

  • WCF Newbie: Create a WCF Proxy to connect to old ASMX Web Service 2011-02-15

    I am currently assigned on a task where I need to create a WCF that will act as a proxy to 3 ASMX services. Currently these services are consumed directly by several applications. Reason for building this WCF proxy is that it would be easier for us t

  • Adding WCF proxy class hides Visual Studio project reference 2011-03-10

    I have a weird visual studio error which is bugging me. I am using Visual Studio 2010 My solution is small and contains 2 projects: Project 1 a class library contains the following classes: Namespace1.DataClass (a serializable class to hold data) Nam

  • Generate a WCF proxy for Silverlight without adding the ASync pattern to the WCF service without hosting the service 2011-03-22

    I got a coding scenario I can't seem to fix. I got a synchronous WCF service and I want to simulate the Add Service Reference (slsvcutil.exe) but without hosting the WCF service. Is this possible? I want use slsvcutil to generate the client from a ws

  • Why would one use the ChannelFactory to instantiate a WCF proxy rather than a Service Reference? 2011-11-08

    There seem to be two ways to instantiate WCF service proxies described here. My question is why would one want to use the ChannelFactory to instantiate a WCF proxy and what are the benefits of this approach? I've met people with a strong opinion on t

  • LightSwitch application chokes while instantiating a WCF proxy 2012-01-21

    I'm trying to create a LightSwitch management panel for a web-based app. Thats why I was setting up a WCF RIA service to interface with the WCF service of the web app. While testing the loading of the users, I discovered that LightSwitch said that it

  • Obfuscate WCF Proxy Classes 2012-03-14

    How to obfuscate WCF proxy classes using Dotfuscator ? I have downloaded Dotfuscator Pro Edition Trial from their website. I obfuscated my app.exe file ,everything was nicely obfuscated but WCF proxy classes were not. (I ILDASMed the exe). The WCF Pr

  • WCF proxy connection open causes errors 2012-03-21

    We are using WCF services hosted on IIS at middle tier and use a WPF client. We are seeing these errors in our production logs. From google i was pointed to a link here http://kennyw.com/indigo/150 that clearly says that this error is related to MaxC

  • How to use Single WCF Proxy in PRISM for all modules (projects)? 2012-04-05

    I am developing a WPF LOB Application having several modules like Sales, Inventory, Purchase etc. I am using WCF to get data from DB. Since creation of WCG proxy is a costly affair, I want to create a single WCF Proxy to use in all the modules. What

  • Do ASMX or WCF Proxy clients use IO completion ports? 2009-02-18

    I'm in the middle of performance testing a critical section of my project, when I notice a whole lot of extra threads being used to to perform WaitOrTimerCallback operations. On closer inspection I can see that these are being spawned by my ASMX clie

  • Singleton in Java App Server.. How bad of an idea is this? 2009-03-18

    I am currently working on some older java code that was developed without App Servers in mind. It is basically a bunch of "black box code" with an input interface, and an output interface. Everything in the "black box" classes are static Data Structu

  • WCF Proxy Generation 2009-03-25

    I use svcutil to generate my wcf proxy that is calling a WSE2 web service. The problem comes when the web service author changes the order of fields in the proxy. I examined the generated proxy and sees that the public attributes are adorned with the

  • Generating WCF proxy against untrusted SSL endpoint 2009-04-01

    I need to generate a WCF proxy for a service exposed by our client. The service is locked down pretty tightly, so this is proving difficult. Also, I'm new to WCF, so I may be missing something obvious... The client has only opened up their firewall t

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 1.181 (s). 13 q(s)