问题
I am attempting to intercept methods on a WCF service server side with the following registration:
containerBuilder.RegisterType<Service>().As<IServiceContract>().InstancePerLifetimeScope()
.EnableInterfaceInterceptors().InterceptedBy(typeof(MethodInterceptor));
however, when I do the service endpoint disappears. The WCF service is hosted inside a Windows Service. Any ideas?
The exception I receive is as follows:
System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at
http://localhost:8000/endpointaddress
that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
The MethodInterceptor is registered as follows:
containerBuilder.Register(componentContext => new MethodInterceptor(invocation =>
{
return new NLogToLoggerAdaptor(LogManager.GetLogger(invocation.InvocationTarget.GetType().FullName));
})).InstancePerLifetimeScope();
来源:https://stackoverflow.com/questions/19297234/intercepting-a-wcf-service-with-autofac