Hello,
My site will be using Spring.NET for DI, localization and validation. Our ASP.NET 2.0 web client will be consuming WCF services using a net-tcp endpoint. In my prototype web app, I am using the following code to register the service with Spring:
Code:<!--service definition--> <object id="postingSearchService" type="Spring.Web.Services.WebServiceProxyFactory, Spring.Services"> <property name="ProxyType" value="SpringSearch.PostingSearchService.SearchServiceClient, SpringSearch" /> <property name="ServiceInterface" value="SpringSearch.PostingSearchService.ISearchService, SpringSearch"/> </object>SearchServiceClient is of Type System.ServiceModel.ClientBase<ISearchService> and implements the ISearchService interface which is the service contract available to me on the web client.Code:<!--page definition--> <object type="search-jobs.aspx" parent="jobSeekerPage"> <property name="PostingSearchService" ref="postingSearchService" /> </object>
When I run the app and trace the calls made to the service (using Microsoft's service trace viewer), I see a "Construct ChannelFactory" activity on each page load and a "Open ClientBase" activity on each call to the service. However, I never see a "Close ClientBase" activity, even after the application is shut down. I can't explicitly call the close method on the serviceclient instance since the ISearchService interface does not contain that method definition. I want to close the channel as soon as possible for resource management purposes.
Questions about this:
1. What are the best practices with Spring.NET as it pertains to DI with WCF services? I am concerned that the application is opening channels but not closing them.
2. Our site gets over 1 million page views a day. Will this approach of injecting the service instances at run time scale appropriately?
thanks in advance for any help.


Reply With Quote
