我是WCF概念的新手。我在wcf示例中看到以下代码代码段。使用请求处理程序实现serivces的地方
public class Service1 : IService1
{
public readonly GetDataRequestHandler requesthandler;
public GetDataResponse GetData(GetDataRequest request)
{
return this.requesthandler.Process(request);
}
}
public class GetDataRequestHandler: RequestHandler<GetDataRequest, GetDataResponse>
{
private readonly GetDataImp _getdata;
public GetDataRequestHandler(GetDataImp _getdata)
{
this._getdata = _getdata;
}
protected override GetDataResponse OnProcess(GetDataRequest request)
{
return _getdata.GetDataValue(request);
}
}
public abstract class RequestHandler<TRequest, TResponse>
{
public virtual TResponse Process(TRequest request)
{
return OnProcess(request);
}
protected abstract TResponse OnProcess(TRequest request);
}
public class GetDataImp
{
public GetDataResponse GetDataValue(GetDataRequest request)
{
string a="ayan"+request.value;
GetDataResponse rep = new GetDataResponse();
rep.Data = a;
return rep;
}
}
但是当我使用wcftestclient调用Service1时,我得到了空指针异常,如&#34;类型&#39; System.NullReferenceException&#39;发生在WcfServiceLibrary1.dll但未在用户代码中处理
附加信息:未将对象引用设置为对象的实例。&#34; on&#39; return this.requesthandler.Process(request)&#39;线。
是否有任何机构可以用这种实施的新完整示例解释问题?