0
votes

I have a MVC App where I inject my WCF service to the Controller using Spring.NET. Following is my configuration

MVC Client Web.Config

<wcf:channelFactory id="LoginService" channelType="App.Interfaces.Services.ILoginService, AppServiceInterfaces" endpointConfigurationName="EndPointLoginService"/>

<endpoint name="EndPointLoginService" address="http://localhost:xxx/LoginService.svc" contract="App.Interfaces.Services.ILoginService" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding1" behaviorConfiguration="ServiceEndpointBehavior" />

WCF Service Web.Config

<object id="LoginService" type= "App.Services.LoginService, AppLoginService" singleton="false">
</object>

<service name="LoginService" behaviorConfiguration="ServiceBehavior">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding1" contract="App.Interfaces.Services.ILoginService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>

Login Service.svc

<%@ ServiceHost Language="C#" Debug="true" Service="LoginService" Factory="Spring.ServiceModel.Activation.ServiceHostFactory" %>

The above work perfectly fine. Now I wanted to implement Performance Logging for the above

So I added the following in the WCF Service Web.Config

<object id="performanceLoggingAroundAdvice" type="AOP.Advice.PerformanceLoggingAroundAdvice, AOP" singleton="false" scope="request"/>

where I have a project called AOP.

and

<object id="LoginService" type= "App.Services.LoginService, AppLoginService" singleton="false">
<property name="InterceptorNames">
  <list>
    <value>performanceLoggingAroundAdvice</value>
  </list>
</property>

But I get an error..saying Initialization of Login Service failed. Can someone help me with the configuration.

1

1 Answers

0
votes

Resolved it by adding the following in my Service layer config

<object type="Spring.Aop.Framework.AutoProxy.TypeNameAutoProxyCreator, Spring.Aop">
  <property name="TypeNames">
  <list>
    <value>App.Services.LoginService</value>
  </list>
</property>
<property name="InterceptorNames">
  <list>
    <value>performanceLoggingAroundAdvice</value>
  </list>
 </property>
</object>

and removed the existing propery Interceptornames property config

<property name="InterceptorNames">
  <list>
    <value>performanceLoggingAroundAdvice</value>
  </list>
</property>

From

<object id="LoginService" type= "App.Services.LoginService, AppLoginService" 
singleton="false">
<property name="InterceptorNames">
  <list>
    <value>performanceLoggingAroundAdvice</value>
  </list>
</property>
</objects>