나는이 주제에 초보자, 그래서 내가 할 수있는이 명확하게하려고합니다 ... 나는 다음과 같은 패키지를로드합니다 WcfModule 만들어 Ninject에 차단 WCF 서비스
: 를 처음에는Bind<IDistributorService>().To<DistributorService>().InRequestScope().Intercept().With<ExceptionInterceptor>();
, 내가 어떤 오류가 발생하지 않습니다,하지만 난 내 기능상의 InterceptAttribute을 넣어 :
[AttributeUsage(AttributeTargets.Method)]
public sealed class HandleExceptionsAttribute : InterceptAttribute
{
public override IInterceptor CreateInterceptor(IProxyRequest request)
{
return request.Kernel.Get<ExceptionInterceptor>();
}
}
[HandleExceptions]
public virtual Result<List<DistributorDataContract>> GetDistributor(string id)
{
//...code...
나는이 기능에 오류 얻을 : (방법의 첫 번째 줄)
문제가 될 수있는 것을 알고InvalidProxyConstructorArgumentsException was unhandled by user code Can not instantiate proxy of class: My.Namespace.DistributorService. Could not find a parameterless constructor.
사람 : 오류로
private ServiceHost CreateNewServiceHost(Type serviceType, Uri[] baseAddresses, WebHttpBehavior webBehavior, WebHttpBinding webHttpBinding)
{
var host = base.CreateServiceHost(serviceType, baseAddresses);
//...
}
? 감사!