Browse Source

[fix]认证方式修改为oauth2.0,并去掉了人工附加认证的过程

master
贾荣国 3 years ago
parent
commit
137b6ffa3b
  1. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json
  2. 18
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/HttpClientInvokers/HttpClientInvoker.cs
  3. 302
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Logs/logs.txt
  4. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Program.cs
  5. 7
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/HttpAuthorizationHandler.cs
  6. 6
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/TokenInfo.cs
  7. 79
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Startup.cs
  8. 3
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Win_in.Sfs.Scp.WebApi.Xml.Host.csproj
  9. 15
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/appsettings.json

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json

@ -38,5 +38,5 @@
}
}
},
"AlwaysAllowAuthorization": true
"AlwaysAllowAuthorization": false
}

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

@ -13,14 +13,15 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost
public class HttpClientInvoker<TInput, TOutput> : IHttpClientInvoker<TInput, TOutput>
{
private readonly HttpAuthorizationHandler _httpAuthorizationHandler;
// private readonly HttpAuthorizationHandler _httpAuthorizationHandler;
private readonly string _baseUrl;
public HttpClientInvoker(IConfiguration configuration
, HttpAuthorizationHandler httpAuthorizationHandler)
// , HttpAuthorizationHandler httpAuthorizationHandler
)
{
_httpAuthorizationHandler = httpAuthorizationHandler;
// _httpAuthorizationHandler = httpAuthorizationHandler;
_baseUrl = configuration["RemoteServices:Default:BaseUrl"];
}
public async Task<TOutput?> InvokeGetAsync(string routeString)
@ -48,11 +49,12 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
if (_httpAuthorizationHandler.IsLoggedIn())
{
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", _httpAuthorizationHandler.GetCurrentBearer());
}
//XmlHost也使用Jwt认证,并连到同一个IDS4 server,不需要再手工添加鉴权信息了
// if (_httpAuthorizationHandler.IsLoggedIn())
// {
// client.DefaultRequestHeaders.Authorization =
// new AuthenticationHeaderValue("Bearer", _httpAuthorizationHandler.GetCurrentBearer());
// }
return client;
}

302
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Logs/logs.txt

@ -6165,3 +6165,305 @@ System.ArgumentNullException: Value cannot be null. (Parameter 'uriString')
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
2022-01-19 15:54:52.664 +08:00 [INF] Starting Win_in.Sfs.Scp.WebApi.Xml.Host.
2022-01-19 15:54:54.160 +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 15:54:56.627 +08:00 [INF] Now listening on: https://localhost:9977
2022-01-19 15:54:56.627 +08:00 [INF] Application started. Press Ctrl+C to shut down.
2022-01-19 15:54:56.627 +08:00 [INF] Hosting environment: Development
2022-01-19 15:54:56.627 +08:00 [INF] Content root path: D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host
2022-01-19 15:55:00.667 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/index.html - -
2022-01-19 15:55:01.128 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/index.html - - - 200 - text/html;charset=utf-8 464.0024ms
2022-01-19 15:55:01.285 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - -
2022-01-19 15:55:01.287 +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.5947ms
2022-01-19 15:55:01.513 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - -
2022-01-19 15:55:01.983 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 469.5680ms
2022-01-19 15:55:07.287 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530
2022-01-19 15:55:07.344 +08:00 [INF] BasicAuthentication was not authenticated. Failure message: Missing Authorization Header
2022-01-19 15:55:07.349 +08:00 [INF] Authorization failed. These requirements were not met:
DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
2022-01-19 15:55:07.350 +08:00 [INF] AuthenticationScheme: BasicAuthentication was challenged.
2022-01-19 15:55:07.350 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530 - 401 0 - 62.8782ms
2022-01-19 15:55:07.351 +08:00 [INF] Connection id "0HMER43U624BD", Request id "0HMER43U624BD:00000005": the application completed without reading the entire request body.
2022-01-19 15:55:12.281 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530
2022-01-19 15:55:12.286 +08:00 [DBG] AuthenticationScheme: BasicAuthentication was successfully authenticated.
2022-01-19 15:55:12.296 +08:00 [INF] Authorization was successful.
2022-01-19 15:55:12.296 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 15:55:12.343 +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 15:55:12.460 +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 15:55:41.719 +08:00 [INF] {"BaererToken":{"access_token":"eyJhbGciOiJSUzI1NiIsImtpZCI6Ijk0MzY5QUY2QTM3OUY0QjI1NzlBMUNFN0MxQkU3MzdBIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2NDI1Nzg5MzUsImV4cCI6MTY3NDExNDkzNSwiaXNzIjoiaHR0cHM6Ly9zY3AuaWFjY2hpbmEubmV0Ojk5ODgiLCJhdWQiOiJXZWJBcGkiLCJjbGllbnRfaWQiOiJXZWJBcGlfQXBwIiwic3ViIjoiMzgwMWFmMWYtNTE3My05Nzk4LWYyN2QtM2EwMTVhMzk1YmM4IiwiYXV0aF90aW1lIjoxNjQyNTc4OTM0LCJpZHAiOiJsb2NhbCIsInJvbGUiOiJhZG1pbiIsInBob25lX251bWJlcl92ZXJpZmllZCI6IkZhbHNlIiwiZW1haWwiOiJhZG1pbkBhYnAuaW8iLCJlbWFpbF92ZXJpZmllZCI6IkZhbHNlIiwibmFtZSI6ImFkbWluIiwiaWF0IjoxNjQyNTc4OTM1LCJzY29wZSI6WyJhZGRyZXNzIiwiZW1haWwiLCJvcGVuaWQiLCJwaG9uZSIsInByb2ZpbGUiLCJyb2xlIiwiV2ViQXBpIiwib2ZmbGluZV9hY2Nlc3MiXSwiYW1yIjpbInB3ZCJdfQ.GJTkdKhW0bCKj4tPxekRpMH7_8KJJ5sALr44UzdENt4SMRu85y-YGSrpGBEKEQPCe_0ak1NylR6KmZDwxw_LmPEu_WbfaSxkfVhYkHld7KqOfPBWkYxZeOLHh1Xk6bSBHFm34alfeJ6GyzzEBM5o-sBE-QxwwHnfBNVUfyEGemvAL83rJRrza5ohaOR5ESkDHhxWVxjOmQ6oLUqJI1hsi2y8NVBGAKhVBR4z4erJWMi0BFWNFsRalc1hMfU5lcJuvvIAmBxq2ctTZe-rW5h5ugst7D_GYSA2_TlBtrkWeHVuurBFRGq3QppbbA4A2EAEiLY4Fap-Uvb8jmMEI2XZjw","expires_in":31536000,"token_type":"Bearer","refresh_token":"B8A4184A9D29A8BB1E5F2C9EEEA5D3F9BAD568D7138FB2F5C1A078A775541402","scope":"address email offline_access openid phone profile role WebApi"},"GetTime":"2022-01-19T15:55:40.9679523+08:00","ExpireTime":"2023-01-19T15:55:40.9679523+08:00"}
2022-01-19 15:55:44.635 +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 32169.7463ms.
2022-01-19 15:55:44.643 +08:00 [INF] Executing OkObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.PartDTO'.
2022-01-19 15:55:44.663 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 32314.2412ms
2022-01-19 15:55:44.664 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 15:55:44.666 +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 32384.4369ms
2022-01-19 15:56:11.587 +08:00 [INF] Application is shutting down...
2022-01-19 16:36:06.058 +08:00 [INF] Starting Win_in.Sfs.Scp.WebApi.Xml.Host.
2022-01-19 16:36:08.091 +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 16:36:09.525 +08:00 [INF] Now listening on: https://localhost:9977
2022-01-19 16:36:09.525 +08:00 [INF] Application started. Press Ctrl+C to shut down.
2022-01-19 16:36:09.525 +08:00 [INF] Hosting environment: Development
2022-01-19 16:36:09.525 +08:00 [INF] Content root path: D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host
2022-01-19 16:36:13.258 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/index.html - -
2022-01-19 16:36:13.820 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/index.html - - - 200 - text/html;charset=utf-8 567.0224ms
2022-01-19 16:36:13.920 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - -
2022-01-19 16:36:13.924 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - - 200 11963 application/javascript;+charset=utf-8 3.7242ms
2022-01-19 16:36:14.164 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - -
2022-01-19 16:36:14.746 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 582.0982ms
2022-01-19 16:36:18.021 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530
2022-01-19 16:36:18.066 +08:00 [INF] Authorization failed. These requirements were not met:
DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
2022-01-19 16:36:18.069 +08:00 [ERR] An unhandled exception has occurred while executing the request.
System.InvalidOperationException: No authenticationScheme was specified, and there was no DefaultChallengeScheme found. The default schemes can be set using either AddAuthentication(string defaultScheme) or AddAuthentication(Action<AuthenticationOptions> configureOptions).
at Microsoft.AspNetCore.Authentication.AuthenticationService.ChallengeAsync(HttpContext context, String scheme, AuthenticationProperties properties)
at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
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 16:36:18.117 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530 - 500 - text/plain 95.8834ms
2022-01-19 16:36:18.121 +08:00 [INF] Connection id "0HMER4QV6D95P", Request id "0HMER4QV6D95P:00000005": the application completed without reading the entire request body.
2022-01-19 16:36:19.382 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530
2022-01-19 16:36:19.383 +08:00 [INF] Authorization failed. These requirements were not met:
DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
2022-01-19 16:36:19.386 +08:00 [ERR] An unhandled exception has occurred while executing the request.
System.InvalidOperationException: No authenticationScheme was specified, and there was no DefaultChallengeScheme found. The default schemes can be set using either AddAuthentication(string defaultScheme) or AddAuthentication(Action<AuthenticationOptions> configureOptions).
at Microsoft.AspNetCore.Authentication.AuthenticationService.ChallengeAsync(HttpContext context, String scheme, AuthenticationProperties properties)
at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
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 16:36:19.386 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530 - 500 - text/plain 4.3444ms
2022-01-19 16:36:19.386 +08:00 [INF] Connection id "0HMER4QV6D95P", Request id "0HMER4QV6D95P:00000006": the application completed without reading the entire request body.
2022-01-19 16:37:31.676 +08:00 [INF] Application is shutting down...
2022-01-19 16:37:42.530 +08:00 [INF] Starting Win_in.Sfs.Scp.WebApi.Xml.Host.
2022-01-19 16:37:43.667 +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 16:37:44.658 +08:00 [INF] Now listening on: https://localhost:9977
2022-01-19 16:37:44.658 +08:00 [INF] Application started. Press Ctrl+C to shut down.
2022-01-19 16:37:44.658 +08:00 [INF] Hosting environment: Development
2022-01-19 16:37:44.658 +08:00 [INF] Content root path: D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host
2022-01-19 16:37:48.536 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/index.html - -
2022-01-19 16:37:49.027 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/index.html - - - 200 - text/html;charset=utf-8 494.2198ms
2022-01-19 16:37:49.125 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - -
2022-01-19 16:37:49.127 +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.4711ms
2022-01-19 16:37:49.290 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - -
2022-01-19 16:37:49.674 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 384.1012ms
2022-01-19 16:37:56.119 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530
2022-01-19 16:37:56.199 +08:00 [INF] Authorization failed. These requirements were not met:
DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
2022-01-19 16:37:56.201 +08:00 [INF] AuthenticationScheme: Bearer was challenged.
2022-01-19 16:37:56.202 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530 - 401 0 - 82.4934ms
2022-01-19 16:37:56.204 +08:00 [INF] Connection id "0HMER4RRG9QF5", Request id "0HMER4RRG9QF5:00000005": the application completed without reading the entire request body.
2022-01-19 16:38:28.922 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part?access_token=eyJhbGciOiJSUzI1NiIsImtpZCI6IjVERDM5MDZFRjhFREM4OTgzM0Q2QjdCNjk0MTk2QUYzIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2NDI1NzQ2ODYsImV4cCI6MTY3NDExMDY4NiwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6OTk4OCIsImF1ZCI6IldlYkFwaSIsImNsaWVudF9pZCI6IldlYkFwaV9BcHAiLCJzdWIiOiI2YzZhZmJkMS0wODU0LWU3YTYtMjVhMi0zYTAxNWExNzhhYzMiLCJhdXRoX3RpbWUiOjE2NDI1NzQ2ODUsImlkcCI6ImxvY2FsIiwicm9sZSI6ImFkbWluIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjoiRmFsc2UiLCJlbWFpbCI6ImFkbWluQGFicC5pbyIsImVtYWlsX3ZlcmlmaWVkIjoiRmFsc2UiLCJuYW1lIjoiYWRtaW4iLCJpYXQiOjE2NDI1NzQ2ODYsInNjb3BlIjpbImFkZHJlc3MiLCJlbWFpbCIsIm9wZW5pZCIsInBob25lIiwicHJvZmlsZSIsInJvbGUiLCJXZWJBcGkiLCJvZmZsaW5lX2FjY2VzcyJdLCJhbXIiOlsicHdkIl19.FosrIa2vI51qKYWZpN-yfCn7oYpu54prZ5NZqTd73NkZK-EJLenB-skqMYTHhukn1qksnaAOzcxZcL4aMxiAt4HKIswMue4d8WQt7d7zavGHrvzRN4jrn5afh7pwoA3nxxSFSlg1GTrwrry05D3-jsAuU60T-Mumy_yTt8kfCPKNVAJYyqBFdsYrd5Rh1Yjudi0Tc27vdp4PSOpPM5bGfzQj_WjQx6S80gK6xoqcQgLem5ek_9fqukQ8S7I7HXtMM3eg4dVMvY99Crp36QaxlPpdQs_69x4J_VO7f5WYmQHSFWgUWF1S5O9vMqD87JvxhUZ39PcTwl8Q21Riau6Jvg application/xml 465
2022-01-19 16:38:28.924 +08:00 [INF] Authorization failed. These requirements were not met:
DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
2022-01-19 16:38:28.925 +08:00 [INF] AuthenticationScheme: Bearer was challenged.
2022-01-19 16:38:28.925 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part?access_token=eyJhbGciOiJSUzI1NiIsImtpZCI6IjVERDM5MDZFRjhFREM4OTgzM0Q2QjdCNjk0MTk2QUYzIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2NDI1NzQ2ODYsImV4cCI6MTY3NDExMDY4NiwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6OTk4OCIsImF1ZCI6IldlYkFwaSIsImNsaWVudF9pZCI6IldlYkFwaV9BcHAiLCJzdWIiOiI2YzZhZmJkMS0wODU0LWU3YTYtMjVhMi0zYTAxNWExNzhhYzMiLCJhdXRoX3RpbWUiOjE2NDI1NzQ2ODUsImlkcCI6ImxvY2FsIiwicm9sZSI6ImFkbWluIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjoiRmFsc2UiLCJlbWFpbCI6ImFkbWluQGFicC5pbyIsImVtYWlsX3ZlcmlmaWVkIjoiRmFsc2UiLCJuYW1lIjoiYWRtaW4iLCJpYXQiOjE2NDI1NzQ2ODYsInNjb3BlIjpbImFkZHJlc3MiLCJlbWFpbCIsIm9wZW5pZCIsInBob25lIiwicHJvZmlsZSIsInJvbGUiLCJXZWJBcGkiLCJvZmZsaW5lX2FjY2VzcyJdLCJhbXIiOlsicHdkIl19.FosrIa2vI51qKYWZpN-yfCn7oYpu54prZ5NZqTd73NkZK-EJLenB-skqMYTHhukn1qksnaAOzcxZcL4aMxiAt4HKIswMue4d8WQt7d7zavGHrvzRN4jrn5afh7pwoA3nxxSFSlg1GTrwrry05D3-jsAuU60T-Mumy_yTt8kfCPKNVAJYyqBFdsYrd5Rh1Yjudi0Tc27vdp4PSOpPM5bGfzQj_WjQx6S80gK6xoqcQgLem5ek_9fqukQ8S7I7HXtMM3eg4dVMvY99Crp36QaxlPpdQs_69x4J_VO7f5WYmQHSFWgUWF1S5O9vMqD87JvxhUZ39PcTwl8Q21Riau6Jvg application/xml 465 - 401 0 - 3.1071ms
2022-01-19 16:38:28.925 +08:00 [INF] Connection id "0HMER4RRG9QF6", Request id "0HMER4RRG9QF6:00000002": the application completed without reading the entire request body.
2022-01-19 16:39:19.304 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part?access_token=eyJhbGciOiJSUzI1NiIsImtpZCI6IjVERDM5MDZFRjhFREM4OTgzM0Q2QjdCNjk0MTk2QUYzIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2NDI1ODE1NTUsImV4cCI6MTY3NDExNzU1NSwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6OTk4OCIsImF1ZCI6IldlYkFwaSIsImNsaWVudF9pZCI6IldlYkFwaV9BcHAiLCJzdWIiOiI2YzZhZmJkMS0wODU0LWU3YTYtMjVhMi0zYTAxNWExNzhhYzMiLCJhdXRoX3RpbWUiOjE2NDI1ODE1NTUsImlkcCI6ImxvY2FsIiwicm9sZSI6ImFkbWluIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjoiRmFsc2UiLCJlbWFpbCI6ImFkbWluQGFicC5pbyIsImVtYWlsX3ZlcmlmaWVkIjoiRmFsc2UiLCJuYW1lIjoiYWRtaW4iLCJpYXQiOjE2NDI1ODE1NTUsInNjb3BlIjpbImFkZHJlc3MiLCJlbWFpbCIsIm9wZW5pZCIsInBob25lIiwicHJvZmlsZSIsInJvbGUiLCJXZWJBcGkiLCJvZmZsaW5lX2FjY2VzcyJdLCJhbXIiOlsicHdkIl19.nPfK84KCclM-Yh7J_7AGsYsCS7fFuv7ZBa7crtTTly6kZSni3TnWjBw9YUD0noYLMMpUakoa-y1cCyMtP0wc7ns9glA6W0BwWUYuvNmPi3A3JKf9C42Ag8XCPgCwHyEpzYEh36EX21HTPYolQjXOz0wfTx-HbpCmBKa7WSOm2BIlXuX3mt88oQ2t3rHt8PB0D4wEhi4OZfhFzOI7sS3Z_ukXkMNkhtxi_mpkWro3DAyfK-jkyT-yd6TRmWNMP0xNK1n4zsaHtYAYW1W6db5acIIOGcDXvyJUDsK78odS6IVycUSupEeujlInWQtQc2HGjZIY_ibr4QTs15I3RceI5A application/xml 465
2022-01-19 16:39:19.305 +08:00 [INF] Authorization failed. These requirements were not met:
DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
2022-01-19 16:39:19.305 +08:00 [INF] AuthenticationScheme: Bearer was challenged.
2022-01-19 16:39:19.305 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part?access_token=eyJhbGciOiJSUzI1NiIsImtpZCI6IjVERDM5MDZFRjhFREM4OTgzM0Q2QjdCNjk0MTk2QUYzIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2NDI1ODE1NTUsImV4cCI6MTY3NDExNzU1NSwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6OTk4OCIsImF1ZCI6IldlYkFwaSIsImNsaWVudF9pZCI6IldlYkFwaV9BcHAiLCJzdWIiOiI2YzZhZmJkMS0wODU0LWU3YTYtMjVhMi0zYTAxNWExNzhhYzMiLCJhdXRoX3RpbWUiOjE2NDI1ODE1NTUsImlkcCI6ImxvY2FsIiwicm9sZSI6ImFkbWluIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjoiRmFsc2UiLCJlbWFpbCI6ImFkbWluQGFicC5pbyIsImVtYWlsX3ZlcmlmaWVkIjoiRmFsc2UiLCJuYW1lIjoiYWRtaW4iLCJpYXQiOjE2NDI1ODE1NTUsInNjb3BlIjpbImFkZHJlc3MiLCJlbWFpbCIsIm9wZW5pZCIsInBob25lIiwicHJvZmlsZSIsInJvbGUiLCJXZWJBcGkiLCJvZmZsaW5lX2FjY2VzcyJdLCJhbXIiOlsicHdkIl19.nPfK84KCclM-Yh7J_7AGsYsCS7fFuv7ZBa7crtTTly6kZSni3TnWjBw9YUD0noYLMMpUakoa-y1cCyMtP0wc7ns9glA6W0BwWUYuvNmPi3A3JKf9C42Ag8XCPgCwHyEpzYEh36EX21HTPYolQjXOz0wfTx-HbpCmBKa7WSOm2BIlXuX3mt88oQ2t3rHt8PB0D4wEhi4OZfhFzOI7sS3Z_ukXkMNkhtxi_mpkWro3DAyfK-jkyT-yd6TRmWNMP0xNK1n4zsaHtYAYW1W6db5acIIOGcDXvyJUDsK78odS6IVycUSupEeujlInWQtQc2HGjZIY_ibr4QTs15I3RceI5A application/xml 465 - 401 0 - 1.4114ms
2022-01-19 16:39:19.306 +08:00 [INF] Connection id "0HMER4RRG9QF7", Request id "0HMER4RRG9QF7:00000002": the application completed without reading the entire request body.
2022-01-19 16:39:42.635 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 465
2022-01-19 16:39:43.208 +08:00 [INF] Successfully validated the token.
2022-01-19 16:39:43.210 +08:00 [INF] Authorization was successful.
2022-01-19 16:39:43.210 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:39:43.233 +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 16:39:43.498 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 261.4307ms
2022-01-19 16:39:43.499 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:39:43.500 +08:00 [ERR] An unhandled exception has occurred while executing the request.
System.InvalidOperationException: There is an error in XML document (0, 0).
---> System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
at System.Guid.GuidResult.SetFailure(Boolean overflow, String failureMessageID)
at System.Guid.TryParseExactP(ReadOnlySpan`1 guidString, GuidResult& result)
at System.Guid.TryParseGuid(ReadOnlySpan`1 guidString, GuidResult& result)
at System.Guid..ctor(String g)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPartCreateDto.Read3_PartCreateDto(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPartCreateDto.Read4_PartCreateDto()
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
at Win_in.Sfs.Scp.WebApi.XmlHost.XDocumentInputFormatter.ReadRequestBodyAsync(InputFormatterContext context) in D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host\XmlFormatter\XDocumentInputFormatter.cs:line 35
at Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BodyModelBinder.BindModelAsync(ModelBindingContext bindingContext)
at Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder.BindModelAsync(ActionContext actionContext, IModelBinder modelBinder, IValueProvider valueProvider, ParameterDescriptor parameter, ModelMetadata metadata, Object value, Object container)
at Microsoft.AspNetCore.Mvc.Controllers.ControllerBinderDelegateProvider.<>c__DisplayClass0_0.<<CreateBinderDelegate>g__Bind|0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
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.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
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 16:39:43.562 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 465 - 500 - text/plain 926.5442ms
2022-01-19 16:40:12.397 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 593
2022-01-19 16:40:12.398 +08:00 [INF] Successfully validated the token.
2022-01-19 16:40:12.398 +08:00 [INF] Authorization was successful.
2022-01-19 16:40:12.398 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:40:12.398 +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 16:40:12.502 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 103.1886ms
2022-01-19 16:40:12.502 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:40:12.503 +08:00 [ERR] An unhandled exception has occurred while executing the request.
System.InvalidOperationException: There is an error in XML document (0, 0).
---> System.InvalidOperationException: <Win_in.Sfs.Scp.WebApi.PartCreateDto xmlns=''> was not expected.
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPartCreateDto.Read4_PartCreateDto()
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
at Win_in.Sfs.Scp.WebApi.XmlHost.XDocumentInputFormatter.ReadRequestBodyAsync(InputFormatterContext context) in D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host\XmlFormatter\XDocumentInputFormatter.cs:line 35
at Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BodyModelBinder.BindModelAsync(ModelBindingContext bindingContext)
at Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder.BindModelAsync(ActionContext actionContext, IModelBinder modelBinder, IValueProvider valueProvider, ParameterDescriptor parameter, ModelMetadata metadata, Object value, Object container)
at Microsoft.AspNetCore.Mvc.Controllers.ControllerBinderDelegateProvider.<>c__DisplayClass0_0.<<CreateBinderDelegate>g__Bind|0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
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.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
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 16:40:12.505 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 593 - 500 - text/plain 107.8005ms
2022-01-19 16:40:58.288 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 549
2022-01-19 16:40:58.289 +08:00 [INF] Successfully validated the token.
2022-01-19 16:40:58.289 +08:00 [INF] Authorization was successful.
2022-01-19 16:40:58.289 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:40:58.289 +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 16:40:58.353 +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 16:41:09.179 +08:00 [INF] {"BaererToken":{"access_token":"eyJhbGciOiJSUzI1NiIsImtpZCI6Ijk0MzY5QUY2QTM3OUY0QjI1NzlBMUNFN0MxQkU3MzdBIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2NDI1ODE2NjcsImV4cCI6MTY3NDExNzY2NywiaXNzIjoiaHR0cHM6Ly9zY3AuaWFjY2hpbmEubmV0Ojk5ODgiLCJhdWQiOiJXZWJBcGkiLCJjbGllbnRfaWQiOiJXZWJBcGlfQXBwIiwic3ViIjoiMzgwMWFmMWYtNTE3My05Nzk4LWYyN2QtM2EwMTVhMzk1YmM4IiwiYXV0aF90aW1lIjoxNjQyNTgxNjY2LCJpZHAiOiJsb2NhbCIsInJvbGUiOiJhZG1pbiIsInBob25lX251bWJlcl92ZXJpZmllZCI6IkZhbHNlIiwiZW1haWwiOiJhZG1pbkBhYnAuaW8iLCJlbWFpbF92ZXJpZmllZCI6IkZhbHNlIiwibmFtZSI6ImFkbWluIiwiaWF0IjoxNjQyNTgxNjY3LCJzY29wZSI6WyJhZGRyZXNzIiwiZW1haWwiLCJvcGVuaWQiLCJwaG9uZSIsInByb2ZpbGUiLCJyb2xlIiwiV2ViQXBpIiwib2ZmbGluZV9hY2Nlc3MiXSwiYW1yIjpbInB3ZCJdfQ.q8xiJYhebe9_nVPDIYOrwGU45FtK3Zop4chxLiyYYFH-oCUBY70ZuLU4-ELY0hKAR96ePgqsNnKX0JPTKc75EEEpZaKMmdpREVeKuurnsYDJolaNgtGhkS_bcWVvKVFnQXi00nDHWyXaHwb7f5s2rLcBqkh8JIcZDcZN3WrHhV53rCGfBo4xqap2a9E2gZlXhVRCJqm91mMityrDb5pp14i40l6jrqM67X-2mhdaFTH1ylvFw4lb_PVZuEj1ByEUBo0PKImaM5QK40Jg_w81MPLYDb-MYTbuX1AOne7aUCK7KMknNhfrTwuOl_OSs-H5_zAnuZMj9pVuKgrsSNg77Q","expires_in":31536000,"token_type":"Bearer","refresh_token":"5394E05232FBDA5F4EF427219A064B18DDDA3B6BB0C9185CEDA358AF572862B0","scope":"address email offline_access openid phone profile role WebApi"},"GetTime":"2022-01-19T16:41:09.1751793+08:00","ExpireTime":"2023-01-19T16:41:09.1751793+08:00"}
2022-01-19 16:41:10.199 +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 11843.2888ms.
2022-01-19 16:41:10.204 +08:00 [INF] Executing OkObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.PartDTO'.
2022-01-19 16:41:10.214 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 11925.4326ms
2022-01-19 16:41:10.215 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:41:10.216 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 549 - 200 1021 application/xml;+charset=utf-8 11927.9591ms
2022-01-19 16:42:06.073 +08:00 [INF] Starting Win_in.Sfs.Scp.WebApi.Xml.Host.
2022-01-19 16:42:07.282 +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 16:42:09.292 +08:00 [INF] Now listening on: https://localhost:9977
2022-01-19 16:42:09.292 +08:00 [INF] Application started. Press Ctrl+C to shut down.
2022-01-19 16:42:09.292 +08:00 [INF] Hosting environment: Development
2022-01-19 16:42:09.292 +08:00 [INF] Content root path: D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host
2022-01-19 16:42:12.991 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/index.html - -
2022-01-19 16:42:13.419 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/index.html - - - 200 - text/html;charset=utf-8 430.4881ms
2022-01-19 16:42:13.481 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - -
2022-01-19 16:42:13.485 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - - - 200 11963 application/javascript;+charset=utf-8 3.2469ms
2022-01-19 16:42:13.701 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - -
2022-01-19 16:42:14.076 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 374.5610ms
2022-01-19 16:42:17.492 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530
2022-01-19 16:42:17.581 +08:00 [INF] Authorization failed. These requirements were not met:
DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
2022-01-19 16:42:17.583 +08:00 [INF] AuthenticationScheme: Bearer was challenged.
2022-01-19 16:42:17.583 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530 - 401 0 - 90.9008ms
2022-01-19 16:42:17.585 +08:00 [INF] Connection id "0HMER4UACEJOS", Request id "0HMER4UACEJOS:00000005": the application completed without reading the entire request body.
2022-01-19 16:42:25.750 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 549
2022-01-19 16:42:27.006 +08:00 [INF] Successfully validated the token.
2022-01-19 16:42:27.009 +08:00 [INF] Authorization was successful.
2022-01-19 16:42:27.009 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:42:27.037 +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 16:42:27.128 +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 16:42:42.712 +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 15580.26ms.
2022-01-19 16:42:42.717 +08:00 [INF] Executing OkObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.PartDTO'.
2022-01-19 16:42:42.730 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 15689.0106ms
2022-01-19 16:42:42.730 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:42:42.731 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 549 - 200 1021 application/xml;+charset=utf-8 16981.0825ms
2022-01-19 16:43:28.639 +08:00 [INF] Starting Win_in.Sfs.Scp.WebApi.Xml.Host.
2022-01-19 16:43:29.910 +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 16:43:31.550 +08:00 [INF] Now listening on: https://localhost:9977
2022-01-19 16:43:31.550 +08:00 [INF] Application started. Press Ctrl+C to shut down.
2022-01-19 16:43:31.550 +08:00 [INF] Hosting environment: Development
2022-01-19 16:43:31.550 +08:00 [INF] Content root path: D:\Work\SFS\Backend\Scp\WebApiService\src\Win_in.Sfs.Scp.WebApi.Xml.Host
2022-01-19 16:43:35.019 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/index.html - -
2022-01-19 16:43:35.450 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/index.html - - - 200 - text/html;charset=utf-8 432.8810ms
2022-01-19 16:43:35.511 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/_framework/aspnetcore-browser-refresh.js - -
2022-01-19 16:43:35.513 +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.9550ms
2022-01-19 16:43:35.737 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - -
2022-01-19 16:43:36.169 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:9977/swagger/v1/swagger.json - - - 200 - application/json;charset=utf-8 432.4015ms
2022-01-19 16:43:44.939 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530
2022-01-19 16:43:45.110 +08:00 [INF] Authorization failed. These requirements were not met:
DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
2022-01-19 16:43:45.113 +08:00 [INF] AuthenticationScheme: Bearer was challenged.
2022-01-19 16:43:45.113 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 530 - 401 0 - 174.4131ms
2022-01-19 16:43:45.117 +08:00 [INF] Connection id "0HMER4V2ST9K8", Request id "0HMER4V2ST9K8:00000005": the application completed without reading the entire request body.
2022-01-19 16:43:51.809 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 549
2022-01-19 16:43:53.213 +08:00 [INF] Successfully validated the token.
2022-01-19 16:43:53.216 +08:00 [INF] Authorization was successful.
2022-01-19 16:43:53.216 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:43:53.248 +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 16:43:53.348 +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 16:44:42.753 +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 49401.2576ms.
2022-01-19 16:44:42.758 +08:00 [INF] Executing OkObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.PartDTO'.
2022-01-19 16:44:42.770 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 49518.1079ms
2022-01-19 16:44:42.770 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:44:42.771 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 549 - 200 1021 application/xml;+charset=utf-8 50962.0645ms
2022-01-19 16:46:02.797 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part?access_token=eyJhbGciOiJSUzI1NiIsImtpZCI6IjVERDM5MDZFRjhFREM4OTgzM0Q2QjdCNjk0MTk2QUYzIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2NDI1ODE5NTUsImV4cCI6MTY3NDExNzk1NSwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6OTk4OCIsImF1ZCI6IldlYkFwaSIsImNsaWVudF9pZCI6IldlYkFwaV9BcHAiLCJzdWIiOiI2YzZhZmJkMS0wODU0LWU3YTYtMjVhMi0zYTAxNWExNzhhYzMiLCJhdXRoX3RpbWUiOjE2NDI1ODE5NTUsImlkcCI6ImxvY2FsIiwicm9sZSI6ImFkbWluIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjoiRmFsc2UiLCJlbWFpbCI6ImFkbWluQGFicC5pbyIsImVtYWlsX3ZlcmlmaWVkIjoiRmFsc2UiLCJuYW1lIjoiYWRtaW4iLCJpYXQiOjE2NDI1ODE5NTUsInNjb3BlIjpbImFkZHJlc3MiLCJlbWFpbCIsIm9wZW5pZCIsInBob25lIiwicHJvZmlsZSIsInJvbGUiLCJXZWJBcGkiLCJvZmZsaW5lX2FjY2VzcyJdLCJhbXIiOlsicHdkIl19.j-4nkyp0htRRM7b8QnHtzKIs3JM1gqQjLJn1rqw5naOho8CsMFvkxEOc2lya1N_ofRoODB8mxRFwO0FvUMc5taBHnP7SLoW7nxXZD4sBBURprA7zr-r9jmeykG6oQowJt1X-XZAVShptta0BFEU4qPRzN4GPAkbSLVb3zSXhU3jETd3OMngfV0vHIPRUWxqJlDEdHVQtmjpolS3O5fA9aE59fOZMBcx3dv_ZBQFOfp1T-DItdR8wjDzF9HPKFtaiuAsudGAfZAL1amyUBBWNx6uYRdav7378cm0qrq3obxZK-Uty3SzaOx4ZcLkj487DOtmjuLIZxjBgCGn_CFfWUQ application/xml 549
2022-01-19 16:46:02.798 +08:00 [INF] Authorization failed. These requirements were not met:
DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
2022-01-19 16:46:02.798 +08:00 [INF] AuthenticationScheme: Bearer was challenged.
2022-01-19 16:46:02.799 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part?access_token=eyJhbGciOiJSUzI1NiIsImtpZCI6IjVERDM5MDZFRjhFREM4OTgzM0Q2QjdCNjk0MTk2QUYzIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2NDI1ODE5NTUsImV4cCI6MTY3NDExNzk1NSwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6OTk4OCIsImF1ZCI6IldlYkFwaSIsImNsaWVudF9pZCI6IldlYkFwaV9BcHAiLCJzdWIiOiI2YzZhZmJkMS0wODU0LWU3YTYtMjVhMi0zYTAxNWExNzhhYzMiLCJhdXRoX3RpbWUiOjE2NDI1ODE5NTUsImlkcCI6ImxvY2FsIiwicm9sZSI6ImFkbWluIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjoiRmFsc2UiLCJlbWFpbCI6ImFkbWluQGFicC5pbyIsImVtYWlsX3ZlcmlmaWVkIjoiRmFsc2UiLCJuYW1lIjoiYWRtaW4iLCJpYXQiOjE2NDI1ODE5NTUsInNjb3BlIjpbImFkZHJlc3MiLCJlbWFpbCIsIm9wZW5pZCIsInBob25lIiwicHJvZmlsZSIsInJvbGUiLCJXZWJBcGkiLCJvZmZsaW5lX2FjY2VzcyJdLCJhbXIiOlsicHdkIl19.j-4nkyp0htRRM7b8QnHtzKIs3JM1gqQjLJn1rqw5naOho8CsMFvkxEOc2lya1N_ofRoODB8mxRFwO0FvUMc5taBHnP7SLoW7nxXZD4sBBURprA7zr-r9jmeykG6oQowJt1X-XZAVShptta0BFEU4qPRzN4GPAkbSLVb3zSXhU3jETd3OMngfV0vHIPRUWxqJlDEdHVQtmjpolS3O5fA9aE59fOZMBcx3dv_ZBQFOfp1T-DItdR8wjDzF9HPKFtaiuAsudGAfZAL1amyUBBWNx6uYRdav7378cm0qrq3obxZK-Uty3SzaOx4ZcLkj487DOtmjuLIZxjBgCGn_CFfWUQ application/xml 549 - 401 0 - 1.9168ms
2022-01-19 16:46:02.799 +08:00 [INF] Connection id "0HMER4V2ST9KA", Request id "0HMER4V2ST9KA:00000002": the application completed without reading the entire request body.
2022-01-19 16:46:13.309 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 549
2022-01-19 16:46:13.310 +08:00 [INF] Successfully validated the token.
2022-01-19 16:46:13.310 +08:00 [INF] Authorization was successful.
2022-01-19 16:46:13.310 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:46:13.311 +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 16:46:13.331 +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 16:46:18.926 +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 5594.8039ms.
2022-01-19 16:46:18.927 +08:00 [INF] Executing OkObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.PartDTO'.
2022-01-19 16:46:18.927 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 5616.3333ms
2022-01-19 16:46:18.927 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PartController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:46:18.927 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/part application/xml 549 - 200 1021 application/xml;+charset=utf-8 5617.7180ms
2022-01-19 16:50:35.566 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/po application/xml 978
2022-01-19 16:50:35.566 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:50:35.569 +08:00 [INF] Route matched with {action = "Create", controller = "PurchaseOrder"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult`1[Win_in.Sfs.Scp.WebApi.PurchaseOrderDTO]] CreateAsync(Win_in.Sfs.Scp.WebApi.PurchaseOrderCreateDTO) on controller Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController (Win_in.Sfs.Scp.WebApi.Xml.Host).
2022-01-19 16:50:35.603 +08:00 [INF] Executing action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) - Validation state: "Valid"
2022-01-19 16:50:47.421 +08:00 [INF] Executed action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host), returned result Microsoft.AspNetCore.Mvc.OkObjectResult in 11817.2456ms.
2022-01-19 16:50:47.421 +08:00 [INF] Executing OkObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.PurchaseOrderDTO'.
2022-01-19 16:50:47.427 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 11858.5705ms
2022-01-19 16:50:47.428 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:50:47.428 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/po application/xml 978 - 200 1424 application/xml;+charset=utf-8 11861.7920ms
2022-01-19 16:52:16.894 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/po application/xml 1009
2022-01-19 16:52:16.895 +08:00 [INF] Successfully validated the token.
2022-01-19 16:52:16.895 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:52:16.896 +08:00 [INF] Route matched with {action = "Create", controller = "PurchaseOrder"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult`1[Win_in.Sfs.Scp.WebApi.PurchaseOrderDTO]] CreateAsync(Win_in.Sfs.Scp.WebApi.PurchaseOrderCreateDTO) on controller Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController (Win_in.Sfs.Scp.WebApi.Xml.Host).
2022-01-19 16:52:16.916 +08:00 [INF] Executing action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) - Validation state: "Valid"
2022-01-19 16:52:17.460 +08:00 [INF] Executed action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host), returned result Microsoft.AspNetCore.Mvc.OkObjectResult in 543.9124ms.
2022-01-19 16:52:17.460 +08:00 [INF] Executing OkObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.PurchaseOrderDTO'.
2022-01-19 16:52:17.460 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 564.3536ms
2022-01-19 16:52:17.460 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:52:17.460 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/po application/xml 1009 - 200 1424 application/xml;+charset=utf-8 565.6993ms
2022-01-19 16:58:22.121 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/po application/xml 1009
2022-01-19 16:58:22.128 +08:00 [INF] Successfully validated the token.
2022-01-19 16:58:22.129 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:58:22.129 +08:00 [INF] Route matched with {action = "Create", controller = "PurchaseOrder"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult`1[Win_in.Sfs.Scp.WebApi.PurchaseOrderDTO]] CreateAsync(Win_in.Sfs.Scp.WebApi.PurchaseOrderCreateDTO) on controller Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController (Win_in.Sfs.Scp.WebApi.Xml.Host).
2022-01-19 16:58:22.148 +08:00 [INF] Executing action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) - Validation state: "Valid"
2022-01-19 16:58:22.615 +08:00 [INF] Executed action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host), returned result Microsoft.AspNetCore.Mvc.OkObjectResult in 466.5012ms.
2022-01-19 16:58:22.615 +08:00 [INF] Executing OkObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.PurchaseOrderDTO'.
2022-01-19 16:58:22.615 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 486.6324ms
2022-01-19 16:58:22.615 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:58:22.616 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/po application/xml 1009 - 200 1424 application/xml;+charset=utf-8 495.1231ms
2022-01-19 16:58:37.338 +08:00 [INF] Request starting HTTP/1.1 POST https://localhost:9977/api/scp/po application/xml 991
2022-01-19 16:58:37.338 +08:00 [INF] Successfully validated the token.
2022-01-19 16:58:37.338 +08:00 [INF] Executing endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:58:37.338 +08:00 [INF] Route matched with {action = "Create", controller = "PurchaseOrder"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.ActionResult`1[Win_in.Sfs.Scp.WebApi.PurchaseOrderDTO]] CreateAsync(Win_in.Sfs.Scp.WebApi.PurchaseOrderCreateDTO) on controller Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController (Win_in.Sfs.Scp.WebApi.Xml.Host).
2022-01-19 16:58:37.356 +08:00 [INF] Executing action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) - Validation state: "Valid"
2022-01-19 16:58:37.563 +08:00 [INF] Executed action method Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host), returned result Microsoft.AspNetCore.Mvc.OkObjectResult in 206.8515ms.
2022-01-19 16:58:37.563 +08:00 [INF] Executing OkObjectResult, writing value of type 'Win_in.Sfs.Scp.WebApi.PurchaseOrderDTO'.
2022-01-19 16:58:37.564 +08:00 [INF] Executed action Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host) in 225.1526ms
2022-01-19 16:58:37.564 +08:00 [INF] Executed endpoint 'Win_in.Sfs.Scp.WebApi.XmlHost.Controllers.PurchaseOrderController.CreateAsync (Win_in.Sfs.Scp.WebApi.Xml.Host)'
2022-01-19 16:58:37.564 +08:00 [INF] Request finished HTTP/1.1 POST https://localhost:9977/api/scp/po application/xml 991 - 200 1406 application/xml;+charset=utf-8 225.8840ms

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Program.cs

@ -41,7 +41,7 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt"))
.WriteTo.Async(c => c.File("Logs/logs.txt",rollingInterval:RollingInterval.Day))
#if DEBUG
.WriteTo.Async(c => c.Console())
#endif

7
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/HttpAuthorizationHandler.cs

@ -1,14 +1,17 @@
using System;
using Microsoft.Extensions.Logging;
namespace Win_in.Sfs.Scp.WebApi.XmlHost
{
public class HttpAuthorizationHandler
{
private readonly ITokenService _tokenService;
private readonly ILogger<HttpAuthorizationHandler> _logger;
public HttpAuthorizationHandler(ITokenService tokenService)
public HttpAuthorizationHandler(ITokenService tokenService,ILogger<HttpAuthorizationHandler> logger)
{
_tokenService = tokenService;
_logger = logger;
}
public bool IsLoggedIn()
@ -22,7 +25,7 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost
var token = _tokenService.GetToken().Result;
GlobalCache.TokenInfo.BaererToken = token;
GlobalCache.TokenInfo.GetTime = DateTimeOffset.Now;
_logger.LogInformation(GlobalCache.TokenInfo.ToString());
return true;
}

6
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/RemoteAutherication/TokenInfo.cs

@ -1,4 +1,5 @@
using System;
using System.Text.Json;
namespace Win_in.Sfs.Scp.WebApi.XmlHost
{
@ -7,5 +8,10 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost
public BaererToken BaererToken { get; set; } = new();
public DateTimeOffset GetTime { get; set; } = DateTimeOffset.Now;
public DateTimeOffset ExpireTime => GetTime.AddSeconds(BaererToken.expires_in);
public override string ToString()
{
return JsonSerializer.Serialize(this);
}
}
}

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

@ -1,56 +1,87 @@
using System;
using System.Net.Http;
using System.Text;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
namespace Win_in.Sfs.Scp.WebApi.XmlHost
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// services.AddControllers()
// .AddXmlDataContractSerializerFormatters();
var configuration = services.GetConfiguration();
services.AddControllers()
.AddMvcOptions(options =>
ConfigureControllers(services);
ConfigureSwagger(services);
ConfigureAuthentication(services,configuration);
ConfigureOptions(services, configuration);
DependencyInjection(services);
}
private static void DependencyInjection(IServiceCollection services)
{
services.AddSingleton(typeof(IHttpClientInvoker<,>), typeof(HttpClientInvoker<,>));
// services.AddSingleton<ITokenService, TokenService>();
// services.AddSingleton<HttpAuthorizationHandler>();
}
private static void ConfigureOptions(IServiceCollection services, IConfiguration configuration)
{
// services.Configure<BasicAuthenticationOptions>(configuration.GetSection("BasicAuthentication"));
// services.Configure<RemoteAuthenticationOptions>(configuration.GetSection("RemoteAuthentication"));
}
private static void ConfigureAuthentication(IServiceCollection services,IConfiguration configuration)
{
services.AddAuthentication("Bearer")
.AddJwtBearer(options =>
{
// options.ModelMetadataDetailsProviders.Add(
// new ExcludeBindingMetadataProvider(typeof(System.Version)));
// options.ModelMetadataDetailsProviders.Add(
// new SuppressChildValidationMetadataProvider(typeof(System.Guid)));
options.InputFormatters.Insert(0, new XDocumentInputFormatter());
// options.OutputFormatters.Insert(0,new XDocumentOutputFormatter());
})
.AddXmlDataContractSerializerFormatters()
.AddXmlSerializerFormatters();
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
options.Audience = "WebApi";
});
// services.AddAuthentication("BasicAuthentication")
// .AddScheme<AuthenticationSchemeOptions, BasicAuthenticationHandler>("BasicAuthentication", null);
}
// services.AddControllers();
private static void ConfigureSwagger(IServiceCollection services)
{
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Win_in.Sfs.Scp.WebApi.Xml.Host", Version = "v1" });
c.SchemaFilter<SwaggerFixArraysInXmlFilter>();
});
}
services.AddAuthentication("BasicAuthentication")
.AddScheme<AuthenticationSchemeOptions, BasicAuthenticationHandler>("BasicAuthentication", null);
services.Configure<BasicAuthenticationOptions>(configuration.GetSection("BasicAuthentication"));
services.Configure<RemoteAuthenticationOptions>(configuration.GetSection("RemoteAuthentication"));
services.AddSingleton(typeof(IHttpClientInvoker<,>),typeof(HttpClientInvoker<,>));
services.AddSingleton<ITokenService, TokenService>();
services.AddSingleton<HttpAuthorizationHandler>();
private static void ConfigureControllers(IServiceCollection services)
{
services.AddControllers()
.AddMvcOptions(options =>
{
options.InputFormatters.Insert(0, new XDocumentInputFormatter());
// options.OutputFormatters.Insert(0,new XDocumentOutputFormatter());
})
.AddXmlDataContractSerializerFormatters()
.AddXmlSerializerFormatters();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)

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

@ -14,10 +14,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="IdentityModel" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Xml" Version="2.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.3" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
<PackageReference Include="System.Text.Json" Version="5.0.0" />
</ItemGroup>
<ItemGroup>

15
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/appsettings.json

@ -13,15 +13,10 @@
"BaseUrl": "https://scp.iacchina.net:9988/"
}
},
"BasicAuthentication": {
"Username": "admin",
"Password": "admin"
},
"RemoteAuthentication": {
"client_id": "WebApi_App",
"client_secret": "1q2w3e*",
"grant_type": "password",
"username": "admin",
"password": "1q2w3E*"
"AuthServer": {
"Authority": "https://localhost:9988",
"RequireHttpsMetadata": "false",
"SwaggerClientId": "WebApi_Swagger",
"SwaggerClientSecret": "1q2w3e*"
}
}
Loading…
Cancel
Save