I am getting an exception on string jsonString;
jsonString
"System.InvalidOperationException: No route matches the supplied values.\r\n at Microsoft.AspNetCore.Mvc.CreatedAtRouteResult.OnFormatting(ActionContext context)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor.ExecuteAsyncCore(ActionContext context, ObjectResult result, Type objectType, Object value)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor.ExecuteAsync(ActionContext context, ObjectResult result)\r\n at Microsoft.AspNetCore.Mvc.ObjectResult.ExecuteResultAsync(ActionContext context)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultAsync(IActionResult result)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResultFilterAsyncTFilter,TFilterAsync\r\n--- End of stack trace from previous location ---\r\n at Microsoft.AspNetCore.Mvc.Infrastructu
re.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()\r\n--- End of stack trace from previous location ---\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)\r\n at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)\r\n at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)\r\n at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.In
voke(HttpContext httpContext)\r\n at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)\r\n at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)\r\n\r\nHEADERS\r\n=======\r\nAccept: application/json\r\nContent-Type: application/json; charset=utf-8\r\nHost: localhost:44384\r\nTransfer-Encoding: chunked\r\ntraceparent: 00-43717d7039b2dc408b1f43ba3f8a5584-d0b9cf536afffd46-00\r\n"
result from the immediate window:
result
{StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
Server: Microsoft-IIS/10.0
X-Powered-By: ASP.NET
Date: Tue, 02 Mar 2021 16:19:09 GMT
Content-Type: text/plain
Content-Length: 2483
}}
Content: {System.Net.Http.HttpConnectionResponseContent}
Headers: {Server: Microsoft-IIS/10.0
X-Powered-By: ASP.NET
Date: Tue, 02 Mar 2021 16:19:09 GMT
}
IsSuccessStatusCode: false
ReasonPhrase: "Internal Server Error"
RequestMessage: {Method: POST, RequestUri: 'https://localhost:44384/api/Service/AddNewService', Version: 1.1, Content: System.Net.Http.Json.JsonContent, Headers:
{
Accept: application/json
traceparent: 00-2e529e5c626bc3438cd69aecec935503-aa1da66de6f9b14a-00
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
}}
StatusCode: InternalServerError
TrailingHeaders: {}
Version: {1.1}
and response:
response
Id = 3897, Status = RanToCompletion, Method = "{null}", Result = "StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:\r\n{\r\n Server: Microsoft-IIS/10.0\r\n X-Powered-By: ASP.NET\r\n Date: Tue, 02 Mar 2021 16:19:09 GMT\r\n Content-Type: text/plain\r\n Content-Length: 2483\r\n}, Trailing Headers:\r\n{\r\n}"
AsyncState: null
CancellationPending: false
CreationOptions: None
Exception: null
Id: 3897
Result: {StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
Server: Microsoft-IIS/10.0
X-Powered-By: ASP.NET
Date: Tue, 02 Mar 2021 16:19:09 GMT
Content-Type: text/plain
Content-Length: 2483
}, Trailing Headers:
{
}}
Status: RanToCompletion
It did indeed as there is a Service record in the db