Browse Source

[fix]代码整理

master
贾荣国 3 years ago
parent
commit
93b62c35fd
  1. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/PartController.cs
  2. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/PurchaseOrderController.cs
  3. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/ReceiptController.cs
  4. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/SupplierController.cs
  5. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Controllers/UnplannedReceiptController.cs
  6. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/GlobalCache.cs
  7. 57
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvoker.cs
  8. 60
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvokers/HttpClientInvoker.cs
  9. 11
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvokers/IHttpClientInvoker.cs
  10. 10
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/IHttpClientInvoker.cs
  11. 3
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/LocalAutherication/BasicAuthenticationHandler.cs
  12. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/LocalAutherication/BasicAuthenticationOptions.cs
  13. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/LocalAutherication/BasicUser.cs
  14. 437
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Logs/logs.txt
  15. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/BaererToken.cs
  16. 34
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/HttpAuthorizationHandler.cs
  17. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/ITokenService.cs
  18. 11
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/RemoteAuthenticationOptions.cs
  19. 11
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/TokenInfo.cs
  20. 12
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/TokenService.cs
  21. 3
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Startup.cs
  22. 47
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/SwaggerFixArraysInXmlFilter.cs
  23. 7
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Win_in.Sfs.Scp.WebApi.Xml.Host.csproj
  24. 50
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/XmlFormatter/SwaggerFixArraysInXmlFilter.cs
  25. 0
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/XmlFormatter/XDocumentInputFormatter.cs

2
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); return Ok(dto);
} }

2
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<ActionResult<PurchaseOrderDTO>> CreateAsync([FromBody] PurchaseOrderCreateDTO input) public virtual async Task<ActionResult<PurchaseOrderDTO>> CreateAsync([FromBody] PurchaseOrderCreateDTO input)
{ {
var dto = await _httpClientInvoker.InvokeAsync(input, RouteConsts.PurchaseOrder); var dto = await _httpClientInvoker.InvokePostAsync(input, RouteConsts.PurchaseOrder);
return Ok(dto); return Ok(dto);
} }

2
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<ActionResult<ReceiptDTO>> CreateAsync([FromBody] ReceiptCreateDTO input) public virtual async Task<ActionResult<ReceiptDTO>> CreateAsync([FromBody] ReceiptCreateDTO input)
{ {
var dto = await _httpClientInvoker.InvokeAsync(input, RouteConsts.Receipt); var dto = await _httpClientInvoker.InvokePostAsync(input, RouteConsts.Receipt);
return Ok(dto); return Ok(dto);
} }

2
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<ActionResult<SupplierDTO>> CreateAsync([FromBody] SupplierCreateDTO input) public virtual async Task<ActionResult<SupplierDTO>> CreateAsync([FromBody] SupplierCreateDTO input)
{ {
var dto = await _httpClientInvoker.InvokeAsync(input, RouteConsts.Supplier); var dto = await _httpClientInvoker.InvokePostAsync(input, RouteConsts.Supplier);
return Ok(dto); return Ok(dto);
} }

2
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<ActionResult<UnplannedReceiptDTO>> CreateAsync([FromBody] UnplannedReceiptCreateDTO input) public virtual async Task<ActionResult<UnplannedReceiptDTO>> CreateAsync([FromBody] UnplannedReceiptCreateDTO input)
{ {
var dto = await _httpClientInvoker.InvokeAsync(input, RouteConsts.UnplannedReceipt); var dto = await _httpClientInvoker.InvokePostAsync(input, RouteConsts.UnplannedReceipt);
return Ok(dto); return Ok(dto);
} }

2
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 class GlobalCache
{ {
public static BaererToken BearerToken { get; set; } public static TokenInfo TokenInfo { get; set; } = new();
} }
} }

57
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvoker.cs

@ -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<TInput, TOutput> : IHttpClientInvoker<TInput, TOutput>
{
private readonly IConfiguration _configuration;
private readonly ITokenService _tokenService;
public HttpClientInvoker(IConfiguration configuration,ITokenService tokenService)
{
_configuration = configuration;
_tokenService = tokenService;
}
public async Task<TOutput> 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<TOutput>();
return dto;
}
}
}

60
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<TInput, TOutput> : IHttpClientInvoker<TInput, TOutput>
{
private readonly HttpAuthorizationHandler _httpAuthorizationHandler;
private readonly string _baseUrl;
public HttpClientInvoker(IConfiguration configuration
, HttpAuthorizationHandler httpAuthorizationHandler)
{
_httpAuthorizationHandler = httpAuthorizationHandler;
_baseUrl = configuration["RemoteServices:Default:BaseUrl"];
}
public async Task<TOutput?> InvokeGetAsync(string routeString)
{
var client = CreateClient();
var response = await client.GetAsync(routeString);
response.EnsureSuccessStatusCode();
var dto = await response.Content.ReadFromJsonAsync<TOutput>();
return dto;
}
public async Task<TOutput?> InvokePostAsync(TInput input, string routeString)
{
var client = CreateClient();
var response = await client.PostAsJsonAsync(routeString, input);
response.EnsureSuccessStatusCode();
var dto = await response.Content.ReadFromJsonAsync<TOutput>();
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;
}
}
}

11
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<in TInput, TOutput>
{
Task<TOutput?> InvokeGetAsync(string routeString);
Task<TOutput?> InvokePostAsync(TInput input, string routeString);
}
}

10
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/IHttpClientInvoker.cs

@ -1,10 +0,0 @@
using System.Runtime.Serialization;
using System.Threading.Tasks;
namespace Win_in.Sfs.Scp.WebApi.XmlHost
{
public interface IHttpClientInvoker<in TInput,TOutput>
{
Task<TOutput> InvokeAsync(TInput input,string routeString);
}
}

3
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/BasicAuthenticationHandler.cs → 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.AspNetCore.Authentication;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; 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<AuthenticationSchemeOptions> public class BasicAuthenticationHandler : AuthenticationHandler<AuthenticationSchemeOptions>
{ {

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/BasicAuthenticationOptions.cs → 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 public class BasicAuthenticationOptions
{ {

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/BasicUser.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/LocalAutherication/BasicUser.cs

437
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: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 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 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.<CreateActivator>b__0(ControllerContext controllerContext)
at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.<CreateControllerFactory>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.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>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.<CreateActivator>b__0(ControllerContext controllerContext)
at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.<CreateControllerFactory>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.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>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.<GetCallSite>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.<CreateActivator>b__0(ControllerContext controllerContext)
at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.<CreateControllerFactory>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.<InvokeNextResourceFilter>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.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>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.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>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.<InvokeNextResourceFilter>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.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>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.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>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.<InvokeNextResourceFilter>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.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>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.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>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.<InvokeNextResourceFilter>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.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>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

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/BaererToken.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/BaererToken.cs

34
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;
}
}
}

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/ITokenService.cs → 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 public interface ITokenService
{ {
Task<BaererToken> GetToken(string baseUrl); Task<BaererToken> GetToken();
} }
} }

11
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; }
}
}

11
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);
}
}

12
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/TokenService.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/TokenService.cs

@ -20,8 +20,9 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost
_options = options.Value; _options = options.Value;
} }
public async Task<BaererToken> GetToken(string baseUrl) public async Task<BaererToken> GetToken()
{ {
var baseUrl = _configuration["RemoteServices:Default:BaseUrl"];
const string routeString = "connect/token"; const string routeString = "connect/token";
var client = new HttpClient(); var client = new HttpClient();
client.BaseAddress = new Uri(baseUrl); client.BaseAddress = new Uri(baseUrl);
@ -47,13 +48,4 @@ 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; }
}
} }

3
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Startup.cs

@ -1,5 +1,4 @@
using System; using System;
using ApiBasicAuth.Security;
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
@ -51,7 +50,7 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost
services.AddSingleton(typeof(IHttpClientInvoker<,>),typeof(HttpClientInvoker<,>)); services.AddSingleton(typeof(IHttpClientInvoker<,>),typeof(HttpClientInvoker<,>));
services.AddSingleton<ITokenService, TokenService>(); services.AddSingleton<ITokenService, TokenService>();
services.AddSingleton<HttpAuthorizationHandler>();
} }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)

47
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/SwaggerFixArraysInXmlFilter.cs

@ -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
};
}
}
}

7
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Win_in.Sfs.Scp.WebApi.Xml.Host.csproj

@ -6,6 +6,13 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Compile Remove="Logs\**" />
<Content Remove="Logs\**" />
<EmbeddedResource Remove="Logs\**" />
<None Remove="Logs\**" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Xml" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Xml" Version="2.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.3" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.3" />

50
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
};
}
}
}
}

0
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/XDocumentInputFormatter.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/XmlFormatter/XDocumentInputFormatter.cs

Loading…
Cancel
Save