コード例 #1
0
        public async Task Invoke(HttpContext httpContext)
        {
            try
            {
                await _next(httpContext);
            }
            catch (Exception ex)
            {
                LogException exception = ExceptionHelper.LogException.ShowDebugInfo(ex);

                HttpClient httpClient = new HttpClient();
                httpClient.BaseAddress = new Uri("http://localhost:62388");

                Task <HttpResponseMessage> httpResponse = httpClient.PostAsJsonAsync("/api/MQService/InsertLog", new LogRequest
                {
                    ProjectCode     = 1,
                    ProjectPassword = "******",
                    LogInfo         = exception.ToString()
                });

                if (!httpResponse.Result.IsSuccessStatusCode)
                {
                }

                httpContext.Response.StatusCode = 500;
            }
        }