WCF service interception is not supported
See original GitHub issueWCF service won’t be hosted if it has an interceptor. Using: Windsor 3.4.0, .Net 4.6.1.
Here is how WCF service is created:
[ServiceContract]
public interface IEmployeeService
{
[OperationContract, WebInvoke(Method = "GET", UriTemplate = "/get/{value}")]
string GetData(string value);
}
public class EmployeeService : IEmployeeService
{
public string GetData(string value)
{
return $"You entered: {value}";
}
}
public interface IWcfInterceptor: IInterceptor { }
public class WcfInterceptor : IWcfInterceptor
{
// implementation goes here
}
// ...........
// 0. Create windsor container, add wcf facility;
// 1. Register the interceptor component;
// 2. Register the WCF service;
Component.For<IEmployeeService>()
.ImplementedBy<EmployeeService>()
.AsWcfService(new RestServiceModel()
.AddBaseAddresses("http://localhost:30115/employee")
.AddEndpoints(WcfEndpoint.ForContract<IEmployeeService>()
.BoundTo(new WebHttpBinding())
.At("rest"))
)
.AsWcfService(new DefaultServiceModel()
.AddBaseAddresses("http://localhost:30115/employee")
.AddEndpoints(WcfEndpoint.ForContract<IEmployeeService>()
.BoundTo(new WSHttpBinding())
.At("soap")).PublishMetadata(o => o.EnableHttpGet())
)
.Interceptors<IWcfInterceptor>() // this is not supported
Issue Analytics
- State:
- Created 6 years ago
- Comments:7
Top Results From Across the Web
How can I intercept all calls to methods in a WCF .svc ...
Ive got a WCF service which has multiple web methods in it. I want to be able to intercept the request on all...
Read more >DynamicProxy interception does not work for WCF clients
Register a WCF client according to the Wiki page WcfIntegration and add AOP interception according to the Wiki DynamicProxy2 I would expect for ......
Read more >WCF services and ASP.NET
This topic discusses hosting Windows Communication Foundation (WCF) services side-by-side with ASP.NET and hosting them in ASP.
Read more >Print
Enrolling in WCF's SMS Program is not a condition of purchase or service. As one of the WCF SMS Programs, WCF Insurance offers...
Read more >WCF Essentials-A Developer's Primer
Without the ServiceContractAttribute, the interface is not visible to WCF clients, in line with the service-oriented tenet that service boundaries are explicit.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi,
I changed your test to be the following:
*** Edited ***
If you are interested in getting the underlying values back you have to call
invocation.proceed
. Also Windsor does not really care that interceptors are registered withIInvocation
as a service type, this is more a Castle Core dynamic proxy thing.Hope this helps! 😃
@fir3pho3nixx Thank you for the help! It was unexpected to me that Winsor does not resolve a component by service type as interceptor when
ComponentRegistration.Interceptors<TService>()
is called. =)