Neliott / ScannergicBackend

0 stars 0 forks source link

Unhandled exception while accessing route /api/allergens #8

Closed EliottJaquierCPNV closed 2 years ago

EliottJaquierCPNV commented 2 years ago

When accessing route /api/allergens, my server throw an Unhandled exception. II have a 'System.IO.FileNotFoundException: Could not load file or assembly 'System.Configuration.ConfigurationManager'

Request to this result

Config used (test server) :

Stack strace / sequence request in the test server:

info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3] Route matched with {action = "GetAllergens", controller = "Allergens"}. Executing controller action with signature ScannergicAPI.Entities.AllergenContainer GetAllergens() on controller ScannergicAPI.Controllers.AllergensController (ScannergicAPI).

info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2] Executed action ScannergicAPI.Controllers.AllergensController.GetAllergens (ScannergicAPI) in 133.973ms

info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint 'ScannergicAPI.Controllers.AllergensController.GetAllergens (ScannergicAPI)'

fail: Microsoft.AspNetCore.Server.Kestrel[13] Connection id "0HMDUSA2LERPA", Request id "0HMDUSA2LERPA:00000002": An unhandled exception was thrown by the application. System.TypeInitializationException: The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

  File name: 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
     --- End of inner exception stack trace ---
     at MySql.Data.MySqlClient.Replication.ReplicationManager.IsReplicationGroup(String groupName)
     at MySql.Data.MySqlClient.MySqlConnection.Open()
     at ScannergicAPI.Repositories.DBConnector.OpenConnection() in C:\Users\eliot\Documents\GitHub\ScannergicBackendAPI\Scannergic\ScannergicAPI\Repositories\DBConnector.cs:line 43
     at ScannergicAPI.Repositories.DBConnector.Select(String query) in C:\Users\eliot\Documents\GitHub\ScannergicBackendAPI\Scannergic\ScannergicAPI\Repositories\DBConnector.cs:line 75
     at ScannergicAPI.Repositories.AllergenRequester.GetPlainAllergensInDB() in C:\Users\eliot\Documents\GitHub\ScannergicBackendAPI\Scannergic\ScannergicAPI\Repositories\AllergenRequester.cs:line 26
     at ScannergicAPI.Repositories.AllergenRepository.GetAllergens() in C:\Users\eliot\Documents\GitHub\ScannergicBackendAPI\Scannergic\ScannergicAPI\Repositories\AllergenRepository.cs:line 34
     at lambda_method1(Closure , Object , Object[] )
     at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
     at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
     at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
     at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
  --- End of stack trace from previous location ---
     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.<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.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
EliottJaquierCPNV commented 2 years ago

I have experienced the same (or a similar) error on windows

EliottJaquierCPNV commented 2 years ago

Stack trace on Windows System.TypeInitializationException HResult=0x80131534 Message=The type initializer for 'MySql.Data.MySqlClient.MySqlConnectAttrs' threw an exception. Source=MySql.Data Arborescence des appels de procédure : at MySql.Data.MySqlClient.NativeDriver.SetConnectAttrs() at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.Authenticate(Boolean reset) at MySql.Data.MySqlClient.NativeDriver.Authenticate(String authMethod, Boolean reset) at MySql.Data.MySqlClient.NativeDriver.Open() at MySql.Data.MySqlClient.Driver.Open() at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection() at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() at MySql.Data.MySqlClient.MySqlPool.GetConnection() at MySql.Data.MySqlClient.MySqlConnection.Open() at ScannergicAPI.Repositories.DBConnector.OpenConnection() in C:\Users\eliot\Documents\GitHub\ScannergicBackendAPI\Scannergic\ScannergicAPI\Repositories\DBConnector.cs:line 44 at ScannergicAPI.Repositories.DBConnector.Select(String query) in C:\Users\eliot\Documents\GitHub\ScannergicBackendAPI\Scannergic\ScannergicAPI\Repositories\DBConnector.cs:line 69 at ScannergicAPI.Repositories.AllergenRequester.GetPlainAllergensInDB() in C:\Users\eliot\Documents\GitHub\ScannergicBackendAPI\Scannergic\ScannergicAPI\Repositories\AllergenRequester.cs:line 26 at TestScannergic.AllergenRequesterTests.GetPlainAllergensInDB_InitialCase_Success() in C:\Users\eliot\Documents\GitHub\ScannergicBackendAPI\Scannergic\TestScannergic\AllergenRequesterTests.cs:line 35

Exception interne 1 : FileNotFoundException : Could not load file or assembly 'System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Le fichier spécifié est introuvable.

EliottJaquierCPNV commented 2 years ago

new gitignore has resolve that problem