From 93b62c35fdd6818b22deb3014334f3685a755fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=BE=E8=8D=A3=E5=9B=BD?= Date: Wed, 19 Jan 2022 14:03:08 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=E4=BB=A3=E7=A0=81=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PartController.cs | 2 +- .../Controllers/PurchaseOrderController.cs | 2 +- .../Controllers/ReceiptController.cs | 2 +- .../Controllers/SupplierController.cs | 2 +- .../Controllers/UnplannedReceiptController.cs | 2 +- .../GlobalCache.cs | 2 +- .../HttpClientInvoker.cs | 57 --- .../HttpClientInvokers/HttpClientInvoker.cs | 60 +++ .../HttpClientInvokers/IHttpClientInvoker.cs | 11 + .../IHttpClientInvoker.cs | 10 - .../BasicAuthenticationHandler.cs | 3 +- .../BasicAuthenticationOptions.cs | 2 +- .../{ => LocalAutherication}/BasicUser.cs | 0 .../Logs/logs.txt | 437 ++++++++++++++++++ .../{ => RemoteAutherication}/BaererToken.cs | 0 .../HttpAuthorizationHandler.cs | 34 ++ .../ITokenService.cs | 2 +- .../RemoteAuthenticationOptions.cs | 11 + .../RemoteAutherication/TokenInfo.cs | 11 + .../{ => RemoteAutherication}/TokenService.cs | 16 +- .../Win_in.Sfs.Scp.WebApi.Xml.Host/Startup.cs | 3 +- .../SwaggerFixArraysInXmlFilter.cs | 47 -- .../Win_in.Sfs.Scp.WebApi.Xml.Host.csproj | 7 + .../SwaggerFixArraysInXmlFilter.cs | 50 ++ .../XDocumentInputFormatter.cs | 0 25 files changed, 635 insertions(+), 138 deletions(-) delete mode 100644 WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvoker.cs create mode 100644 WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvokers/HttpClientInvoker.cs create mode 100644 WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvokers/IHttpClientInvoker.cs delete mode 100644 WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/IHttpClientInvoker.cs rename WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/{ => LocalAutherication}/BasicAuthenticationHandler.cs (97%) rename WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/{ => LocalAutherication}/BasicAuthenticationOptions.cs (80%) rename WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/{ => LocalAutherication}/BasicUser.cs (100%) rename WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/{ => RemoteAutherication}/BaererToken.cs (100%) create mode 100644 WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/HttpAuthorizationHandler.cs rename WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/{ => RemoteAutherication}/ITokenService.cs (69%) create mode 100644 WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/RemoteAuthenticationOptions.cs create mode 100644 WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/TokenInfo.cs rename WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/{ => RemoteAutherication}/TokenService.cs (75%) delete mode 100644 WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/SwaggerFixArraysInXmlFilter.cs create mode 100644 WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/XmlFormatter/SwaggerFixArraysInXmlFilter.cs rename WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/{ => XmlFormatter}/XDocumentInputFormatter.cs (100%) diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/PartController.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/PartController.cs index e9aa820..e2e8a78 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/PartController.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/PartController.cs @@ -28,7 +28,7 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost.Controllers { - var dto = await _httpClientInvoker.InvokeAsync(input, RouteConsts.Part); + var dto = await _httpClientInvoker.InvokePostAsync(input, RouteConsts.Part); return Ok(dto); } diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/PurchaseOrderController.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/PurchaseOrderController.cs index 98b5873..15fd50c 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/PurchaseOrderController.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/PurchaseOrderController.cs @@ -25,7 +25,7 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost.Controllers public virtual async Task> CreateAsync([FromBody] PurchaseOrderCreateDTO input) { - var dto = await _httpClientInvoker.InvokeAsync(input, RouteConsts.PurchaseOrder); + var dto = await _httpClientInvoker.InvokePostAsync(input, RouteConsts.PurchaseOrder); return Ok(dto); } diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/ReceiptController.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/ReceiptController.cs index cf3176b..727a0a4 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/ReceiptController.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/ReceiptController.cs @@ -25,7 +25,7 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost.Controllers public virtual async Task> CreateAsync([FromBody] ReceiptCreateDTO input) { - var dto = await _httpClientInvoker.InvokeAsync(input, RouteConsts.Receipt); + var dto = await _httpClientInvoker.InvokePostAsync(input, RouteConsts.Receipt); return Ok(dto); } diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/SupplierController.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/SupplierController.cs index c009c29..6941538 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/SupplierController.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/SupplierController.cs @@ -25,7 +25,7 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost.Controllers public virtual async Task> CreateAsync([FromBody] SupplierCreateDTO input) { - var dto = await _httpClientInvoker.InvokeAsync(input, RouteConsts.Supplier); + var dto = await _httpClientInvoker.InvokePostAsync(input, RouteConsts.Supplier); return Ok(dto); } diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/UnplannedReceiptController.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/UnplannedReceiptController.cs index 600497a..bcad7cf 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/UnplannedReceiptController.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/UnplannedReceiptController.cs @@ -24,7 +24,7 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost.Controllers public virtual async Task> CreateAsync([FromBody] UnplannedReceiptCreateDTO input) { - var dto = await _httpClientInvoker.InvokeAsync(input, RouteConsts.UnplannedReceipt); + var dto = await _httpClientInvoker.InvokePostAsync(input, RouteConsts.UnplannedReceipt); return Ok(dto); } diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/GlobalCache.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/GlobalCache.cs index a26c640..936ad54 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/GlobalCache.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/GlobalCache.cs @@ -2,6 +2,6 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost { public static class GlobalCache { - public static BaererToken BearerToken { get; set; } + public static TokenInfo TokenInfo { get; set; } = new(); } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvoker.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvoker.cs deleted file mode 100644 index 3d822da..0000000 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvoker.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Net; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Net.Http.Json; -using System.Runtime.Serialization; -using System.Threading.Tasks; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Options; -using Volo.Abp.DependencyInjection; - -namespace Win_in.Sfs.Scp.WebApi.XmlHost -{ - - public class HttpClientInvoker : IHttpClientInvoker - { - private readonly IConfiguration _configuration; - private readonly ITokenService _tokenService; - - public HttpClientInvoker(IConfiguration configuration,ITokenService tokenService) - { - _configuration = configuration; - _tokenService = tokenService; - } - - public async Task InvokeAsync(TInput input,string routeString) - { - var baseUrl = _configuration["RemoteServices:Default:BaseUrl"]; - - if (GlobalCache.BearerToken==null) - { - var token =await _tokenService.GetToken(baseUrl); - GlobalCache.BearerToken = token; - } - - var client = new HttpClient(); - client.BaseAddress = new Uri(baseUrl); - client.DefaultRequestHeaders.Accept.Clear(); - client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); - client.DefaultRequestHeaders.Authorization = - new AuthenticationHeaderValue("Bearer", GlobalCache.BearerToken.access_token); - var response = await client.PostAsJsonAsync(routeString, input); - if (response.StatusCode == HttpStatusCode.Unauthorized) - { - var token = await _tokenService.GetToken(baseUrl); - GlobalCache.BearerToken = token; - client.DefaultRequestHeaders.Authorization = - new AuthenticationHeaderValue("Bearer", GlobalCache.BearerToken.access_token); - response = await client.PostAsJsonAsync(routeString, input); - } - response.EnsureSuccessStatusCode(); - - var dto = await response.Content.ReadFromJsonAsync(); - return dto; - } - } -} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvokers/HttpClientInvoker.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvokers/HttpClientInvoker.cs new file mode 100644 index 0000000..5b15f39 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvokers/HttpClientInvoker.cs @@ -0,0 +1,60 @@ +using System; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Net.Http.Json; +using System.Runtime.Serialization; +using System.Threading.Tasks; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Options; + +namespace Win_in.Sfs.Scp.WebApi.XmlHost +{ + + public class HttpClientInvoker : IHttpClientInvoker + { + private readonly HttpAuthorizationHandler _httpAuthorizationHandler; + private readonly string _baseUrl; + + + public HttpClientInvoker(IConfiguration configuration + , HttpAuthorizationHandler httpAuthorizationHandler) + { + _httpAuthorizationHandler = httpAuthorizationHandler; + _baseUrl = configuration["RemoteServices:Default:BaseUrl"]; + } + public async Task InvokeGetAsync(string routeString) + { + var client = CreateClient(); + var response = await client.GetAsync(routeString); + response.EnsureSuccessStatusCode(); + var dto = await response.Content.ReadFromJsonAsync(); + return dto; + } + + public async Task InvokePostAsync(TInput input, string routeString) + { + var client = CreateClient(); + var response = await client.PostAsJsonAsync(routeString, input); + response.EnsureSuccessStatusCode(); + var dto = await response.Content.ReadFromJsonAsync(); + return dto; + } + + private HttpClient CreateClient() + { + var client = new HttpClient(); + client.BaseAddress = new Uri(_baseUrl); + client.DefaultRequestHeaders.Accept.Clear(); + client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + + if (_httpAuthorizationHandler.IsLoggedIn()) + { + client.DefaultRequestHeaders.Authorization = + new AuthenticationHeaderValue("Bearer", _httpAuthorizationHandler.GetCurrentBearer()); + } + + return client; + } + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvokers/IHttpClientInvoker.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvokers/IHttpClientInvoker.cs new file mode 100644 index 0000000..361f976 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvokers/IHttpClientInvoker.cs @@ -0,0 +1,11 @@ +using System.Runtime.Serialization; +using System.Threading.Tasks; + +namespace Win_in.Sfs.Scp.WebApi.XmlHost +{ + public interface IHttpClientInvoker + { + Task InvokeGetAsync(string routeString); + Task InvokePostAsync(TInput input, string routeString); + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/IHttpClientInvoker.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/IHttpClientInvoker.cs deleted file mode 100644 index 1134a09..0000000 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/IHttpClientInvoker.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Runtime.Serialization; -using System.Threading.Tasks; - -namespace Win_in.Sfs.Scp.WebApi.XmlHost -{ - public interface IHttpClientInvoker - { - Task InvokeAsync(TInput input,string routeString); - } -} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/BasicAuthenticationHandler.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/LocalAutherication/BasicAuthenticationHandler.cs similarity index 97% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/BasicAuthenticationHandler.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/LocalAutherication/BasicAuthenticationHandler.cs index cf89949..075fe25 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/BasicAuthenticationHandler.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/LocalAutherication/BasicAuthenticationHandler.cs @@ -7,9 +7,8 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Win_in.Sfs.Scp.WebApi.XmlHost; -namespace ApiBasicAuth.Security +namespace Win_in.Sfs.Scp.WebApi.XmlHost { public class BasicAuthenticationHandler : AuthenticationHandler { diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/BasicAuthenticationOptions.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/LocalAutherication/BasicAuthenticationOptions.cs similarity index 80% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/BasicAuthenticationOptions.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/LocalAutherication/BasicAuthenticationOptions.cs index 3ac57cd..a26aceb 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/BasicAuthenticationOptions.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/LocalAutherication/BasicAuthenticationOptions.cs @@ -1,4 +1,4 @@ -namespace ApiBasicAuth.Security +namespace Win_in.Sfs.Scp.WebApi.XmlHost { public class BasicAuthenticationOptions { diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/BasicUser.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/LocalAutherication/BasicUser.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/BasicUser.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/LocalAutherication/BasicUser.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Logs/logs.txt b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Logs/logs.txt index 1f8db5d..c0d4923 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Logs/logs.txt +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Logs/logs.txt @@ -5728,3 +5728,440 @@ System.Net.Http.HttpRequestException: Response status code does not indicate suc 2022-01-19 10:50:57.913 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - 2022-01-19 10:50:58.330 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 416.9399ms 2022-01-19 11:07:20.964 +08:00 [INF] Application is shutting down... +2022-01-19 12:42:38.217 +08:00 [INF] Starting Win_in.Sfs.Scp.WebApi.Xml.Host. +2022-01-19 12:42:41.528 +08:00 [FTL] Host terminated unexpectedly! +System.AggregateException: Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: Volo.Abp.Http.Client.DynamicProxying.IDynamicProxyHttpClientFactory Lifetime: Transient ImplementationType: Volo.Abp.Http.Client.DynamicProxying.DefaultDynamicProxyHttpClientFactory': Unable to resolve service for type 'System.Net.Http.IHttpClientFactory' while attempting to activate 'Volo.Abp.Http.Client.DynamicProxying.DefaultDynamicProxyHttpClientFactory'.) (Error while validating the service descriptor 'ServiceType: Volo.Abp.Http.Client.DynamicProxying.DefaultDynamicProxyHttpClientFactory Lifetime: Transient ImplementationType: Volo.Abp.Http.Client.DynamicProxying.DefaultDynamicProxyHttpClientFactory': Unable to resolve service for type 'System.Net.Http.IHttpClientFactory' while attempting to activate 'Volo.Abp.Http.Client.DynamicProxying.DefaultDynamicProxyHttpClientFactory'.) + ---> System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: Volo.Abp.Http.Client.DynamicProxying.IDynamicProxyHttpClientFactory Lifetime: Transient ImplementationType: Volo.Abp.Http.Client.DynamicProxying.DefaultDynamicProxyHttpClientFactory': Unable to resolve service for type 'System.Net.Http.IHttpClientFactory' while attempting to activate 'Volo.Abp.Http.Client.DynamicProxying.DefaultDynamicProxyHttpClientFactory'. + ---> System.InvalidOperationException: Unable to resolve service for type 'System.Net.Http.IHttpClientFactory' while attempting to activate 'Volo.Abp.Http.Client.DynamicProxying.DefaultDynamicProxyHttpClientFactory'. + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite(ServiceDescriptor serviceDescriptor, CallSiteChain callSiteChain) + at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor) + --- End of inner exception stack trace --- + at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor) + at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options) + --- End of inner exception stack trace --- + at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options) + at Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(IServiceCollection services, ServiceProviderOptions options) + at Microsoft.Extensions.DependencyInjection.DefaultServiceProviderFactory.CreateServiceProvider(IServiceCollection containerBuilder) + at Microsoft.Extensions.Hosting.Internal.ServiceFactoryAdapter`1.CreateServiceProvider(Object containerBuilder) + at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider() + at Microsoft.Extensions.Hosting.HostBuilder.Build() + at Win_in.Sfs.Scp.WebApi.XmlHost.Program.Main(String[] args) in D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host\Program.cs:line 19 + ---> (Inner Exception #1) System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: Volo.Abp.Http.Client.DynamicProxying.DefaultDynamicProxyHttpClientFactory Lifetime: Transient ImplementationType: Volo.Abp.Http.Client.DynamicProxying.DefaultDynamicProxyHttpClientFactory': Unable to resolve service for type 'System.Net.Http.IHttpClientFactory' while attempting to activate 'Volo.Abp.Http.Client.DynamicProxying.DefaultDynamicProxyHttpClientFactory'. + ---> System.InvalidOperationException: Unable to resolve service for type 'System.Net.Http.IHttpClientFactory' while attempting to activate 'Volo.Abp.Http.Client.DynamicProxying.DefaultDynamicProxyHttpClientFactory'. + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite(ServiceDescriptor serviceDescriptor, CallSiteChain callSiteChain) + at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor) + --- End of inner exception stack trace --- + at Microsoft.Extensions.DependencyInjection.ServiceProvider.ValidateService(ServiceDescriptor descriptor) + at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options)<--- + +2022-01-19 12:44:04.785 +08:00 [INF] Starting Win_in.Sfs.Scp.WebApi.Xml.Host. +2022-01-19 12:44:05.837 +08:00 [INF] User profile is available. Using 'C:\Users\changketec\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. +2022-01-19 12:44:07.626 +08:00 [INF] Now listening on: https://localhost:9977 +2022-01-19 12:44:07.626 +08:00 [INF] Application started. Press Ctrl+C to shut down. +2022-01-19 12:44:07.626 +08:00 [INF] Hosting environment: Development +2022-01-19 12:44:07.626 +08:00 [INF] Content root path: D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host +2022-01-19 12:44:11.444 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/index.html - - +2022-01-19 12:44:11.747 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/index.html - - - 200 - text/html;charset=utf-8 304.3021ms +2022-01-19 12:44:11.803 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - +2022-01-19 12:44:11.806 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - - 200 11963 application/javascript;+charset=utf-8 2.6462ms +2022-01-19 12:44:13.987 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - +2022-01-19 12:44:14.299 +08:00 [WRN] An error occurred while trying to create an XmlSerializer for the type 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto'. +System.InvalidOperationException: There was an error reflecting type 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto'. + ---> System.InvalidOperationException: There was an error reflecting property 'Localization'. + ---> System.InvalidOperationException: There was an error reflecting type 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationConfigurationDto'. + ---> System.NotSupportedException: Cannot serialize member Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationConfigurationDto.Values of type System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], because it implements IDictionary. + at System.Xml.Serialization.TypeScope.GetDefaultIndexer(Type type, String memberInfo) + at System.Xml.Serialization.TypeScope.ImportTypeDesc(Type type, MemberInfo memberInfo, Boolean directReference) + at System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo source, Boolean directReference, Boolean throwOnError) + at System.Xml.Serialization.StructModel.GetPropertyModel(PropertyInfo propertyInfo) + at System.Xml.Serialization.StructModel.GetFieldModel(MemberInfo memberInfo) + at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) + --- End of inner exception stack trace --- + at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping(MemberMapping accessor, FieldModel model, XmlAttributes a, String ns, Type choiceIdentifierType, Boolean rpc, Boolean openModel, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportFieldMapping(StructModel parent, FieldModel model, XmlAttributes a, String ns, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) + --- End of inner exception stack trace --- + at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) + --- End of inner exception stack trace --- + at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportElement(TypeModel model, XmlRootAttribute root, String defaultNamespace, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type, XmlRootAttribute root, String defaultNamespace) + at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace) + at System.Xml.Serialization.XmlSerializer..ctor(Type type) + at Microsoft.AspNetCore.Mvc.Formatters.XmlSerializerOutputFormatter.CreateSerializer(Type type) +2022-01-19 12:44:14.307 +08:00 [WRN] An error occurred while trying to create an XmlSerializer for the type 'Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel'. +System.InvalidOperationException: There was an error reflecting type 'Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel'. + ---> System.InvalidOperationException: Cannot serialize member 'Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel.Modules' of type 'System.Collections.Generic.IDictionary`2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Volo.Abp.Http.Modeling.ModuleApiDescriptionModel, Volo.Abp.Http, Version=4.4.2.0, Culture=neutral, PublicKeyToken=null]]', see inner exception for more details. + ---> System.NotSupportedException: Cannot serialize member Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel.Modules of type System.Collections.Generic.IDictionary`2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Volo.Abp.Http.Modeling.ModuleApiDescriptionModel, Volo.Abp.Http, Version=4.4.2.0, Culture=neutral, PublicKeyToken=null]] because it is an interface. + --- End of inner exception stack trace --- + at System.Xml.Serialization.StructModel.CheckSupportedMember(TypeDesc typeDesc, MemberInfo member, Type type) + at System.Xml.Serialization.StructModel.GetPropertyModel(PropertyInfo propertyInfo) + at System.Xml.Serialization.StructModel.GetFieldModel(MemberInfo memberInfo) + at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) + --- End of inner exception stack trace --- + at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportElement(TypeModel model, XmlRootAttribute root, String defaultNamespace, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type, XmlRootAttribute root, String defaultNamespace) + at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace) + at System.Xml.Serialization.XmlSerializer..ctor(Type type) + at Microsoft.AspNetCore.Mvc.Formatters.XmlSerializerOutputFormatter.CreateSerializer(Type type) +2022-01-19 12:44:14.410 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 423.3876ms +2022-01-19 12:44:19.847 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/api/abp/api-definition - - +2022-01-19 12:44:19.891 +08:00 [INF] BasicAuthentication was not authenticated. Failure message: Missing Authorization Header +2022-01-19 12:44:19.893 +08:00 [INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController.Get (Volo.Abp.AspNetCore.Mvc)' +2022-01-19 12:44:19.976 +08:00 [INF] Route matched with {area = "abp", action = "Get", controller = "AbpApiDefinition"}. Executing controller action with signature Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel Get(Volo.Abp.Http.Modeling.ApplicationApiDescriptionModelRequestDto) on controller Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController (Volo.Abp.AspNetCore.Mvc). +2022-01-19 12:44:19.982 +08:00 [INF] Executed action Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController.Get (Volo.Abp.AspNetCore.Mvc) in 1.6438ms +2022-01-19 12:44:19.982 +08:00 [INF] Executed endpoint 'Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController.Get (Volo.Abp.AspNetCore.Mvc)' +2022-01-19 12:44:19.986 +08:00 [ERR] An unhandled exception has occurred while executing the request. +System.InvalidOperationException: Unable to resolve service for type 'Volo.Abp.Http.Modeling.IApiDescriptionModelProvider' while attempting to activate 'Volo.Abp.AspNetCore.Mvc.ApiExploring.AbpApiDefinitionController'. + at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired) + at lambda_method3(Closure , IServiceProvider , Object[] ) + at Microsoft.AspNetCore.Mvc.Controllers.ControllerActivatorProvider.<>c__DisplayClass4_0.b__0(ControllerContext controllerContext) + at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.g__CreateController|0(ControllerContext controllerContext) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() +--- End of stack trace from previous location --- + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker invoker) + at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) + at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) + at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) + at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) + at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) + at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context) +2022-01-19 12:44:20.002 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/api/abp/api-definition - - - 500 - text/plain 155.1492ms +2022-01-19 12:45:00.584 +08:00 [INF] Starting Win_in.Sfs.Scp.WebApi.Xml.Host. +2022-01-19 12:45:01.538 +08:00 [INF] User profile is available. Using 'C:\Users\changketec\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. +2022-01-19 12:45:02.869 +08:00 [INF] Now listening on: https://localhost:9977 +2022-01-19 12:45:02.869 +08:00 [INF] Application started. Press Ctrl+C to shut down. +2022-01-19 12:45:02.869 +08:00 [INF] Hosting environment: Development +2022-01-19 12:45:02.869 +08:00 [INF] Content root path: D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host +2022-01-19 12:45:06.908 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/index.html - - +2022-01-19 12:45:07.320 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/index.html - - - 200 - text/html;charset=utf-8 414.6169ms +2022-01-19 12:45:07.377 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - +2022-01-19 12:45:07.382 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - - 200 11963 application/javascript;+charset=utf-8 4.0220ms +2022-01-19 12:45:07.687 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - +2022-01-19 12:45:08.123 +08:00 [WRN] An error occurred while trying to create an XmlSerializer for the type 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto'. +System.InvalidOperationException: There was an error reflecting type 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto'. + ---> System.InvalidOperationException: There was an error reflecting property 'Localization'. + ---> System.InvalidOperationException: There was an error reflecting type 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationConfigurationDto'. + ---> System.NotSupportedException: Cannot serialize member Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationLocalizationConfigurationDto.Values of type System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], because it implements IDictionary. + at System.Xml.Serialization.TypeScope.GetDefaultIndexer(Type type, String memberInfo) + at System.Xml.Serialization.TypeScope.ImportTypeDesc(Type type, MemberInfo memberInfo, Boolean directReference) + at System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo source, Boolean directReference, Boolean throwOnError) + at System.Xml.Serialization.StructModel.GetPropertyModel(PropertyInfo propertyInfo) + at System.Xml.Serialization.StructModel.GetFieldModel(MemberInfo memberInfo) + at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) + --- End of inner exception stack trace --- + at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping(MemberMapping accessor, FieldModel model, XmlAttributes a, String ns, Type choiceIdentifierType, Boolean rpc, Boolean openModel, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportFieldMapping(StructModel parent, FieldModel model, XmlAttributes a, String ns, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) + --- End of inner exception stack trace --- + at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) + --- End of inner exception stack trace --- + at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportElement(TypeModel model, XmlRootAttribute root, String defaultNamespace, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type, XmlRootAttribute root, String defaultNamespace) + at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace) + at System.Xml.Serialization.XmlSerializer..ctor(Type type) + at Microsoft.AspNetCore.Mvc.Formatters.XmlSerializerOutputFormatter.CreateSerializer(Type type) +2022-01-19 12:45:08.152 +08:00 [WRN] An error occurred while trying to create an XmlSerializer for the type 'Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel'. +System.InvalidOperationException: There was an error reflecting type 'Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel'. + ---> System.InvalidOperationException: Cannot serialize member 'Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel.Modules' of type 'System.Collections.Generic.IDictionary`2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Volo.Abp.Http.Modeling.ModuleApiDescriptionModel, Volo.Abp.Http, Version=4.4.2.0, Culture=neutral, PublicKeyToken=null]]', see inner exception for more details. + ---> System.NotSupportedException: Cannot serialize member Volo.Abp.Http.Modeling.ApplicationApiDescriptionModel.Modules of type System.Collections.Generic.IDictionary`2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Volo.Abp.Http.Modeling.ModuleApiDescriptionModel, Volo.Abp.Http, Version=4.4.2.0, Culture=neutral, PublicKeyToken=null]] because it is an interface. + --- End of inner exception stack trace --- + at System.Xml.Serialization.StructModel.CheckSupportedMember(TypeDesc typeDesc, MemberInfo member, Type type) + at System.Xml.Serialization.StructModel.GetPropertyModel(PropertyInfo propertyInfo) + at System.Xml.Serialization.StructModel.GetFieldModel(MemberInfo memberInfo) + at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) + --- End of inner exception stack trace --- + at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportElement(TypeModel model, XmlRootAttribute root, String defaultNamespace, RecursionLimiter limiter) + at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type, XmlRootAttribute root, String defaultNamespace) + at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace) + at System.Xml.Serialization.XmlSerializer..ctor(Type type) + at Microsoft.AspNetCore.Mvc.Formatters.XmlSerializerOutputFormatter.CreateSerializer(Type type) +2022-01-19 12:45:08.271 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 583.9614ms +2022-01-19 12:45:14.152 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/api/abp/application-configuration - - +2022-01-19 12:45:14.202 +08:00 [INF] BasicAuthentication was not authenticated. Failure message: Missing Authorization Header +2022-01-19 12:45:14.203 +08:00 [INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc)' +2022-01-19 12:45:14.278 +08:00 [INF] Route matched with {area = "abp", action = "Get", controller = "AbpApplicationConfiguration"}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ApplicationConfigurationDto] GetAsync() on controller Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController (Volo.Abp.AspNetCore.Mvc). +2022-01-19 12:45:14.286 +08:00 [INF] Executed action Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc) in 2.6174ms +2022-01-19 12:45:14.286 +08:00 [INF] Executed endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync (Volo.Abp.AspNetCore.Mvc)' +2022-01-19 12:45:14.290 +08:00 [ERR] An unhandled exception has occurred while executing the request. +System.InvalidOperationException: Unable to resolve service for type 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.IAbpApplicationConfigurationAppService' while attempting to activate 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController'. + at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired) + at lambda_method9(Closure , IServiceProvider , Object[] ) + at Microsoft.AspNetCore.Mvc.Controllers.ControllerActivatorProvider.<>c__DisplayClass4_0.b__0(ControllerContext controllerContext) + at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.g__CreateController|0(ControllerContext controllerContext) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() +--- End of stack trace from previous location --- + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker invoker) + at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) + at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) + at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) + at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) + at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) + at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context) +2022-01-19 12:45:14.309 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/api/abp/application-configuration - - - 500 - text/plain 156.5670ms +2022-01-19 12:46:29.626 +08:00 [INF] Starting Win_in.Sfs.Scp.WebApi.Xml.Host. +2022-01-19 12:46:30.606 +08:00 [INF] User profile is available. Using 'C:\Users\changketec\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. +2022-01-19 12:46:31.323 +08:00 [INF] Now listening on: https://localhost:9977 +2022-01-19 12:46:31.324 +08:00 [INF] Application started. Press Ctrl+C to shut down. +2022-01-19 12:46:31.324 +08:00 [INF] Hosting environment: Development +2022-01-19 12:46:31.324 +08:00 [INF] Content root path: D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host +2022-01-19 12:46:34.851 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/index.html - - +2022-01-19 12:46:35.502 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/index.html - - - 200 - text/html;charset=utf-8 655.4526ms +2022-01-19 12:46:35.633 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - +2022-01-19 12:46:35.636 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - - 200 11963 application/javascript;+charset=utf-8 2.6569ms +2022-01-19 12:46:35.938 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - +2022-01-19 12:46:36.448 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 510.6497ms +2022-01-19 12:46:39.976 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530 +2022-01-19 12:46:40.010 +08:00 [INF] BasicAuthentication was not authenticated. Failure message: Missing Authorization Header +2022-01-19 12:46:40.014 +08:00 [INF] Authorization failed. These requirements were not met: +DenyAnonymousAuthorizationRequirement: Requires an authenticated user. +2022-01-19 12:46:40.015 +08:00 [INF] AuthenticationScheme: BasicAuthentication was challenged. +2022-01-19 12:46:40.016 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530 - 401 0 - 39.5748ms +2022-01-19 12:46:40.016 +08:00 [INF] Connection id "0HMER0QKSAB36", Request id "0HMER0QKSAB36:00000005": the application completed without reading the entire request body. +2022-01-19 12:46:46.893 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530 +2022-01-19 12:46:46.895 +08:00 [INF] BasicAuthentication was not authenticated. Failure message: Invalid Username or Password +2022-01-19 12:46:46.896 +08:00 [INF] Authorization failed. These requirements were not met: +DenyAnonymousAuthorizationRequirement: Requires an authenticated user. +2022-01-19 12:46:46.896 +08:00 [INF] AuthenticationScheme: BasicAuthentication was challenged. +2022-01-19 12:46:46.896 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530 - 401 0 - 3.3177ms +2022-01-19 12:46:46.896 +08:00 [INF] Connection id "0HMER0QKSAB36", Request id "0HMER0QKSAB36:00000006": the application completed without reading the entire request body. +2022-01-19 12:47:00.616 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530 +2022-01-19 12:47:00.617 +08:00 [INF] BasicAuthentication was not authenticated. Failure message: Missing Authorization Header +2022-01-19 12:47:00.617 +08:00 [INF] Authorization failed. These requirements were not met: +DenyAnonymousAuthorizationRequirement: Requires an authenticated user. +2022-01-19 12:47:00.618 +08:00 [INF] AuthenticationScheme: BasicAuthentication was challenged. +2022-01-19 12:47:00.618 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530 - 401 0 - 1.3615ms +2022-01-19 12:47:00.618 +08:00 [INF] Connection id "0HMER0QKSAB36", Request id "0HMER0QKSAB36:00000007": the application completed without reading the entire request body. +2022-01-19 12:47:03.166 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530 +2022-01-19 12:47:03.167 +08:00 [DBG] AuthenticationScheme: BasicAuthentication was successfully authenticated. +2022-01-19 12:47:03.169 +08:00 [INF] Authorization was successful. +2022-01-19 12:47:03.170 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)' +2022-01-19 12:47:03.195 +08:00 [INF] Route matched with {action = "Create", controller = "Part"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult`1[Win_in.Sfs.Scp.WebApi.PartDTO]] CreateAsync(Win_in.Sfs.Scp.WebApi.PartCreateDto) on controller Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController (Win_in.Sfs.Scp.WebApi.Xml.Host). +2022-01-19 12:47:03.304 +08:00 [INF] Executing action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) - Validation state: "Valid" +2022-01-19 12:47:16.129 +08:00 [INF] Executed action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host), returned result Microsoft.AspNetCore.Mvc.OkObjectResult in 12820.5129ms. +2022-01-19 12:47:16.136 +08:00 [INF] Executing OkObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.PartDTO'. +2022-01-19 12:47:16.149 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 12949.7281ms +2022-01-19 12:47:16.149 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)' +2022-01-19 12:47:16.150 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530 - 200 1021 application/xml;+charset=utf-8 12983.9957ms +2022-01-19 12:56:09.504 +08:00 [INF] Starting Win_in.Sfs.Scp.WebApi.Xml.Host. +2022-01-19 12:56:10.517 +08:00 [INF] User profile is available. Using 'C:\Users\changketec\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. +2022-01-19 12:56:11.877 +08:00 [INF] Now listening on: https://localhost:9977 +2022-01-19 12:56:11.877 +08:00 [INF] Application started. Press Ctrl+C to shut down. +2022-01-19 12:56:11.877 +08:00 [INF] Hosting environment: Development +2022-01-19 12:56:11.877 +08:00 [INF] Content root path: D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host +2022-01-19 12:56:15.438 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/index.html - - +2022-01-19 12:56:15.774 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/index.html - - - 200 - text/html;charset=utf-8 339.7854ms +2022-01-19 12:56:15.870 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - +2022-01-19 12:56:15.872 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - - 200 11963 application/javascript;+charset=utf-8 1.9743ms +2022-01-19 12:56:18.016 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - +2022-01-19 12:56:18.395 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 378.6234ms +2022-01-19 12:56:42.947 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/receipt application/xml 725 +2022-01-19 12:56:42.998 +08:00 [DBG] AuthenticationScheme: BasicAuthentication was successfully authenticated. +2022-01-19 12:56:42.999 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)' +2022-01-19 12:56:43.024 +08:00 [INF] Route matched with {action = "Create", controller = "Receipt"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult`1[Win_in.Sfs.Scp.WebApi.ReceiptDTO]] CreateAsync(Win_in.Sfs.Scp.WebApi.ReceiptCreateDTO) on controller Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController (Win_in.Sfs.Scp.WebApi.Xml.Host). +2022-01-19 12:56:43.030 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 2.6854ms +2022-01-19 12:56:43.030 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)' +2022-01-19 12:56:43.032 +08:00 [ERR] An unhandled exception has occurred while executing the request. +System.InvalidOperationException: Unable to resolve service for type 'Win_in.Sfs.Scp.WebApi.XmlHost.HttpAuthorizationHandler' while attempting to activate 'Win_in.Sfs.Scp.WebApi.XmlHost.HttpClientInvoker`2[Win_in.Sfs.Scp.WebApi.ReceiptCreateDTO,Win_in.Sfs.Scp.WebApi.ReceiptDTO]'. + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(Type serviceType, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateOpenGeneric(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot, Boolean throwOnConstraintViolation) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateOpenGeneric(Type serviceType, CallSiteChain callSiteChain) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite(Type serviceType, CallSiteChain callSiteChain) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.<>c__DisplayClass7_0.b__0(Type type) + at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite(Type serviceType, CallSiteChain callSiteChain) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.CreateServiceAccessor(Type serviceType) + at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) + at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType) + at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired) + at lambda_method9(Closure , IServiceProvider , Object[] ) + at Microsoft.AspNetCore.Mvc.Controllers.ControllerActivatorProvider.<>c__DisplayClass4_0.b__0(ControllerContext controllerContext) + at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.g__CreateController|0(ControllerContext controllerContext) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() +--- End of stack trace from previous location --- + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() +--- End of stack trace from previous location --- + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker invoker) + at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) + at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) + at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) + at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) + at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) + at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context) +2022-01-19 12:56:43.079 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/receipt application/xml 725 - 500 - text/plain 132.3851ms +2022-01-19 12:56:43.082 +08:00 [INF] Connection id "0HMER101VODV3", Request id "0HMER101VODV3:00000005": the application completed without reading the entire request body. +2022-01-19 12:58:09.587 +08:00 [INF] Starting Win_in.Sfs.Scp.WebApi.Xml.Host. +2022-01-19 12:58:26.640 +08:00 [INF] User profile is available. Using 'C:\Users\changketec\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. +2022-01-19 12:58:27.252 +08:00 [INF] Now listening on: https://localhost:9977 +2022-01-19 12:58:27.252 +08:00 [INF] Application started. Press Ctrl+C to shut down. +2022-01-19 12:58:27.252 +08:00 [INF] Hosting environment: Development +2022-01-19 12:58:27.252 +08:00 [INF] Content root path: D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host +2022-01-19 12:58:30.263 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/index.html - - +2022-01-19 12:58:30.581 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/index.html - - - 200 - text/html;charset=utf-8 320.5396ms +2022-01-19 12:58:30.625 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - +2022-01-19 12:58:30.626 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - - 200 11963 application/javascript;+charset=utf-8 1.8008ms +2022-01-19 12:58:32.796 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - +2022-01-19 12:58:33.146 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 349.9303ms +2022-01-19 12:58:37.879 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/receipt application/xml 725 +2022-01-19 12:58:37.918 +08:00 [DBG] AuthenticationScheme: BasicAuthentication was successfully authenticated. +2022-01-19 12:58:37.919 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)' +2022-01-19 12:58:37.948 +08:00 [INF] Route matched with {action = "Create", controller = "Receipt"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult`1[Win_in.Sfs.Scp.WebApi.ReceiptDTO]] CreateAsync(Win_in.Sfs.Scp.WebApi.ReceiptCreateDTO) on controller Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController (Win_in.Sfs.Scp.WebApi.Xml.Host). +2022-01-19 12:58:38.039 +08:00 [INF] Executing action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) - Validation state: "Valid" +2022-01-19 12:58:50.897 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 12944.6128ms +2022-01-19 12:58:50.901 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)' +2022-01-19 12:58:50.906 +08:00 [ERR] An unhandled exception has occurred while executing the request. +System.ArgumentNullException: Value cannot be null. (Parameter 'uriString') + at System.Uri..ctor(String uriString) + at Win_in.Sfs.Scp.WebApi.XmlHost.HttpClientInvoker`2.CreateClient() in D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host\HttpClientInvokers\HttpClientInvoker.cs:line 47 + at Win_in.Sfs.Scp.WebApi.XmlHost.HttpClientInvoker`2.InvokePostAsync(TInput input, String routeString) in D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host\HttpClientInvokers\HttpClientInvoker.cs:line 37 + at Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync(ReceiptCreateDTO input) in D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host\Controllers\ReceiptController.cs:line 28 + at lambda_method5(Closure , Object ) + at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Logged|12_1(ControllerActionInvoker invoker) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() +--- End of stack trace from previous location --- + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() +--- End of stack trace from previous location --- + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker invoker) + at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) + at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) + at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) + at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) + at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) + at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context) +2022-01-19 12:58:50.963 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/receipt application/xml 725 - 500 - text/plain 13083.2707ms +2022-01-19 12:58:53.130 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/receipt application/xml 725 +2022-01-19 12:58:57.565 +08:00 [DBG] AuthenticationScheme: BasicAuthentication was successfully authenticated. +2022-01-19 12:58:57.565 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)' +2022-01-19 12:58:57.565 +08:00 [INF] Route matched with {action = "Create", controller = "Receipt"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult`1[Win_in.Sfs.Scp.WebApi.ReceiptDTO]] CreateAsync(Win_in.Sfs.Scp.WebApi.ReceiptCreateDTO) on controller Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController (Win_in.Sfs.Scp.WebApi.Xml.Host). +2022-01-19 12:59:04.119 +08:00 [INF] Executing action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) - Validation state: "Valid" +2022-01-19 12:59:11.650 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 14084.8541ms +2022-01-19 12:59:11.650 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)' +2022-01-19 12:59:11.651 +08:00 [ERR] An unhandled exception has occurred while executing the request. +System.ArgumentNullException: Value cannot be null. (Parameter 'uriString') + at System.Uri..ctor(String uriString) + at Win_in.Sfs.Scp.WebApi.XmlHost.HttpClientInvoker`2.CreateClient() in D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host\HttpClientInvokers\HttpClientInvoker.cs:line 47 + at Win_in.Sfs.Scp.WebApi.XmlHost.HttpClientInvoker`2.InvokePostAsync(TInput input, String routeString) in D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host\HttpClientInvokers\HttpClientInvoker.cs:line 37 + at Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync(ReceiptCreateDTO input) in D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host\Controllers\ReceiptController.cs:line 28 + at lambda_method5(Closure , Object ) + at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Logged|12_1(ControllerActionInvoker invoker) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() +--- End of stack trace from previous location --- + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() +--- End of stack trace from previous location --- + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker invoker) + at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) + at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) + at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) + at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) + at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) + at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context) +2022-01-19 12:59:11.652 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/receipt application/xml 725 - 500 - text/plain 18522.7632ms +2022-01-19 12:59:12.928 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/index.html - - +2022-01-19 12:59:12.948 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/index.html - - - 200 - text/html;charset=utf-8 19.2817ms +2022-01-19 12:59:12.991 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - +2022-01-19 12:59:12.991 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - - 200 11963 application/javascript;+charset=utf-8 0.3499ms +2022-01-19 12:59:13.120 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - +2022-01-19 12:59:13.129 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 8.9411ms +2022-01-19 12:59:18.173 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/receipt application/xml 725 +2022-01-19 12:59:18.175 +08:00 [DBG] AuthenticationScheme: BasicAuthentication was successfully authenticated. +2022-01-19 12:59:18.175 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)' +2022-01-19 12:59:18.175 +08:00 [INF] Route matched with {action = "Create", controller = "Receipt"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult`1[Win_in.Sfs.Scp.WebApi.ReceiptDTO]] CreateAsync(Win_in.Sfs.Scp.WebApi.ReceiptCreateDTO) on controller Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController (Win_in.Sfs.Scp.WebApi.Xml.Host). +2022-01-19 12:59:18.194 +08:00 [INF] Executing action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) - Validation state: "Valid" +2022-01-19 12:59:24.250 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 6074.2474ms +2022-01-19 12:59:24.253 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)' +2022-01-19 12:59:24.257 +08:00 [ERR] An unhandled exception has occurred while executing the request. +System.ArgumentNullException: Value cannot be null. (Parameter 'uriString') + at System.Uri..ctor(String uriString) + at Win_in.Sfs.Scp.WebApi.XmlHost.HttpClientInvoker`2.CreateClient() in D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host\HttpClientInvokers\HttpClientInvoker.cs:line 47 + at Win_in.Sfs.Scp.WebApi.XmlHost.HttpClientInvoker`2.InvokePostAsync(TInput input, String routeString) in D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host\HttpClientInvokers\HttpClientInvoker.cs:line 37 + at Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync(ReceiptCreateDTO input) in D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host\Controllers\ReceiptController.cs:line 28 + at lambda_method5(Closure , Object ) + at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Logged|12_1(ControllerActionInvoker invoker) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() +--- End of stack trace from previous location --- + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() +--- End of stack trace from previous location --- + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker invoker) + at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) + at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) + at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) + at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) + at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) + at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context) +2022-01-19 12:59:24.258 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/receipt application/xml 725 - 500 - text/plain 6085.1163ms +2022-01-19 13:01:06.589 +08:00 [INF] Starting Win_in.Sfs.Scp.WebApi.Xml.Host. +2022-01-19 13:01:07.676 +08:00 [INF] User profile is available. Using 'C:\Users\changketec\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. +2022-01-19 13:01:08.447 +08:00 [INF] Now listening on: https://localhost:9977 +2022-01-19 13:01:08.447 +08:00 [INF] Application started. Press Ctrl+C to shut down. +2022-01-19 13:01:08.447 +08:00 [INF] Hosting environment: Development +2022-01-19 13:01:08.447 +08:00 [INF] Content root path: D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host +2022-01-19 13:01:12.234 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/index.html - - +2022-01-19 13:01:12.851 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/index.html - - - 200 - text/html;charset=utf-8 627.0004ms +2022-01-19 13:01:12.966 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - +2022-01-19 13:01:12.969 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - - 200 11963 application/javascript;+charset=utf-8 2.7844ms +2022-01-19 13:01:15.126 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - +2022-01-19 13:01:15.498 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 371.5537ms +2022-01-19 13:01:29.465 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/receipt application/xml 725 +2022-01-19 13:01:29.515 +08:00 [DBG] AuthenticationScheme: BasicAuthentication was successfully authenticated. +2022-01-19 13:01:29.516 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)' +2022-01-19 13:01:29.548 +08:00 [INF] Route matched with {action = "Create", controller = "Receipt"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult`1[Win_in.Sfs.Scp.WebApi.ReceiptDTO]] CreateAsync(Win_in.Sfs.Scp.WebApi.ReceiptCreateDTO) on controller Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController (Win_in.Sfs.Scp.WebApi.Xml.Host). +2022-01-19 13:01:29.700 +08:00 [INF] Executing action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) - Validation state: "Valid" +2022-01-19 13:01:34.441 +08:00 [INF] Executed action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host), returned result Microsoft.AspNetCore.Mvc.OkObjectResult in 4737.6219ms. +2022-01-19 13:01:34.449 +08:00 [INF] Executing OkObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.ReceiptDTO'. +2022-01-19 13:01:34.463 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 4911.0935ms +2022-01-19 13:01:34.464 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.ReceiptController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)' +2022-01-19 13:01:34.465 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/receipt application/xml 725 - 200 1210 application/xml;+charset=utf-8 5000.1431ms diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/BaererToken.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/BaererToken.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/BaererToken.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/BaererToken.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/HttpAuthorizationHandler.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/HttpAuthorizationHandler.cs new file mode 100644 index 0000000..fadda4a --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/HttpAuthorizationHandler.cs @@ -0,0 +1,34 @@ +using System; + +namespace Win_in.Sfs.Scp.WebApi.XmlHost +{ + public class HttpAuthorizationHandler + { + private readonly ITokenService _tokenService; + + public HttpAuthorizationHandler(ITokenService tokenService) + { + _tokenService = tokenService; + } + + public bool IsLoggedIn() + { + if (!string.IsNullOrEmpty(GlobalCache.TokenInfo.BaererToken?.access_token) && + GlobalCache.TokenInfo.ExpireTime > DateTimeOffset.Now) + { + return true; + } + + var token = _tokenService.GetToken().Result; + GlobalCache.TokenInfo.BaererToken = token; + GlobalCache.TokenInfo.GetTime = DateTimeOffset.Now; + + return true; + } + + public string GetCurrentBearer() + { + return GlobalCache.TokenInfo.BaererToken.access_token; + } + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/ITokenService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/ITokenService.cs similarity index 69% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/ITokenService.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/ITokenService.cs index 77d39da..53a8629 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/ITokenService.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/ITokenService.cs @@ -4,6 +4,6 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost { public interface ITokenService { - Task GetToken(string baseUrl); + Task GetToken(); } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/RemoteAuthenticationOptions.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/RemoteAuthenticationOptions.cs new file mode 100644 index 0000000..9e82d6a --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/RemoteAuthenticationOptions.cs @@ -0,0 +1,11 @@ +namespace Win_in.Sfs.Scp.WebApi.XmlHost +{ + public class RemoteAuthenticationOptions + { + public string client_id { get; set; } + public string client_secret { get; set; } + public string grant_type { get; set; } + public string username { get; set; } + public string password { get; set; } + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/TokenInfo.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/TokenInfo.cs new file mode 100644 index 0000000..825cb80 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/TokenInfo.cs @@ -0,0 +1,11 @@ +using System; + +namespace Win_in.Sfs.Scp.WebApi.XmlHost +{ + public class TokenInfo + { + public BaererToken BaererToken { get; set; } = new(); + public DateTimeOffset GetTime { get; set; } = DateTimeOffset.Now; + public DateTimeOffset ExpireTime => GetTime.AddSeconds(BaererToken.expires_in); + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/TokenService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/TokenService.cs similarity index 75% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/TokenService.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/TokenService.cs index 9d94c16..56c468c 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/TokenService.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/TokenService.cs @@ -9,19 +9,20 @@ using Microsoft.Extensions.Options; namespace Win_in.Sfs.Scp.WebApi.XmlHost { - public class TokenService:ITokenService + public class TokenService : ITokenService { private readonly IConfiguration _configuration; private readonly RemoteAuthenticationOptions _options; - public TokenService(IConfiguration configuration,IOptions options) + public TokenService(IConfiguration configuration, IOptions options) { _configuration = configuration; _options = options.Value; } - public async Task GetToken(string baseUrl) + public async Task GetToken() { + var baseUrl = _configuration["RemoteServices:Default:BaseUrl"]; const string routeString = "connect/token"; var client = new HttpClient(); client.BaseAddress = new Uri(baseUrl); @@ -45,15 +46,6 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost } - - } - public class RemoteAuthenticationOptions - { - public string client_id { get; set; } - public string client_secret { get; set; } - public string grant_type { get; set; } - public string username { get; set; } - public string password { get; set; } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Startup.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Startup.cs index 74129e2..39a3fb3 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Startup.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Startup.cs @@ -1,5 +1,4 @@ using System; -using ApiBasicAuth.Security; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -51,7 +50,7 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost services.AddSingleton(typeof(IHttpClientInvoker<,>),typeof(HttpClientInvoker<,>)); services.AddSingleton(); - + services.AddSingleton(); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/SwaggerFixArraysInXmlFilter.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/SwaggerFixArraysInXmlFilter.cs deleted file mode 100644 index aae920c..0000000 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/SwaggerFixArraysInXmlFilter.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Microsoft.OpenApi.Models; -using Swashbuckle.AspNetCore.SwaggerGen; - -internal class SwaggerFixArraysInXmlFilter : ISchemaFilter -{ - public void Apply(OpenApiSchema schema, SchemaFilterContext context) - { - var type = context.Type; - - // Fix issues with xml array examples not generating correctly - if (type.IsValueType) - { - return; - } - - if (type.Name == "String") - { - return; - } - - schema.Xml = new OpenApiXml { Name = type.Name }; - if (schema.Properties == null) - { - return; - } - - foreach (var property in schema.Properties) - { - //Array property, which wraps its elements - if (property.Value.Type != "array") - { - continue; - } - - property.Value.Xml = new OpenApiXml - { - Name = $"{property.Key}", - Wrapped = true - }; - property.Value.Items.Xml = new OpenApiXml - { - Name = $"{property.Value.Items.Type}", - Wrapped = true - }; - } - } -} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Win_in.Sfs.Scp.WebApi.Xml.Host.csproj b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Win_in.Sfs.Scp.WebApi.Xml.Host.csproj index 981ede5..71d5981 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Win_in.Sfs.Scp.WebApi.Xml.Host.csproj +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Win_in.Sfs.Scp.WebApi.Xml.Host.csproj @@ -6,6 +6,13 @@ + + + + + + + diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/XmlFormatter/SwaggerFixArraysInXmlFilter.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/XmlFormatter/SwaggerFixArraysInXmlFilter.cs new file mode 100644 index 0000000..5d4dc4b --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/XmlFormatter/SwaggerFixArraysInXmlFilter.cs @@ -0,0 +1,50 @@ +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace Win_in.Sfs.Scp.WebApi.XmlHost +{ + internal class SwaggerFixArraysInXmlFilter : ISchemaFilter + { + public void Apply(OpenApiSchema schema, SchemaFilterContext context) + { + var type = context.Type; + + // Fix issues with xml array examples not generating correctly + if (type.IsValueType) + { + return; + } + + if (type.Name == "String") + { + return; + } + + schema.Xml = new OpenApiXml { Name = type.Name }; + if (schema.Properties == null) + { + return; + } + + foreach (var property in schema.Properties) + { + //Array property, which wraps its elements + if (property.Value.Type != "array") + { + continue; + } + + property.Value.Xml = new OpenApiXml + { + Name = $"{property.Key}", + Wrapped = true + }; + property.Value.Items.Xml = new OpenApiXml + { + Name = $"{property.Value.Items.Type}", + Wrapped = true + }; + } + } + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/XDocumentInputFormatter.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/XmlFormatter/XDocumentInputFormatter.cs similarity index 100% rename from WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/XDocumentInputFormatter.cs rename to WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/XmlFormatter/XDocumentInputFormatter.cs