private async Task <SoaResponseType> ProcessRequest(HttpContext context) { try { var entity = SoaServiceProvider.GetInstance().GetService(context.Request.Path, Router); using (logger.BeginScope(new KeyValuePair <string, string>("soa.service", entity.ToString()))) { try { return(await RequestHandler(context, entity)); } catch (Exception e2) { if (e2.InnerException != null) { e2 = e2.InnerException; } logger.Error(e2, "Soa请求处理失败"); return(BuildFailureResponse(e2)); } } } catch (SoaServiceException e1) { logger.Error(e1, "Soa request process failure"); return(BuildFailureResponse(e1)); } }
/// <summary> /// 根据配置,加载Soa服务对应的类,并获取各个服务类对应的请求类型和响应类型 /// </summary> public void Init(IServiceCollection services) { SoaServiceProvider.GetInstance().ConfigService(services); }