I've been trying to solve this issue for several days now, but I haven't found anyone able to help. Kind of reaching out here hoping to reach someone who knows where I'm going wrong.
I have an ASP.NET Core MVC application with a Web API as well (1.1) that uses Integrated Windows Authentication (NTLM), and WindowsIdentity Class impersonation to forward user credentials from MVC to the API for REST calls.
What is happening is I am getting a "502.3 Bad Gateway" whenever I do a try and redirect the user in an Action method on the MVC application after issuing a POST/PUT request to the Web API. I want to clarify that the request is generated in the MVC application,
and the actual request goes through the API, and the response does come back to the MVC application. The URL would be generated that a redirect should be sent to, but the 502.3 happens right at this point. It doesn't matter if I'm on IIS Express, Testing Server
IIS, or Production Server IIS, they all net the same result. This started happening after I added in the Impersonation portion of my program. I don't know if this is an IIS issue or a .NET Core issue.
The steps are as follows:
1. User hits submit or save (Creating a new or saving an old one)
2. User credentials are impersonated with WindowsIdentity.RunImpersonated() and a REST call is made
3. The POST/PUT request is sent to the Web API, and a 200 response is received
4. Based upon that Status Code (200/201/204) I have RedirectToAction() setup to send them to the view of the updated/created object
5. The HTTP GET request is sent for the View of that object
6. 502 Error is thrown
Here's what the log files look like:
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1] Request starting HTTP/1.1 POST http://<server>/tim/Incidents/SaveIncident?incidentId=58 application/x-www-form-urlencoded 763 info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1] Authorization was successful for user: [user]. info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1] Executing action method TIM.MVC.Controllers.IncidentsController.SaveIncident (TIM.MVC) with arguments (58, TIM.API.Models.Incident) - ModelState is Valid info: Microsoft.AspNetCore.Mvc.Internal.RedirectResultExecutor[1] Executing RedirectResult, redirecting to /tim/Incidents/View/58. info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2] Executed action TIM.MVC.Controllers.IncidentsController.SaveIncident (TIM.MVC) in 1397.8175ms info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2] Request finished in 2097.562ms 302 info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1] Request starting HTTP/1.1 GET http://<server>/tim/Incidents/View/58 info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1] Authorization was successful for user: [user]. info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1] Executing action method TIM.MVC.Controllers.IncidentsController.View (TIM.MVC) with arguments (58) - ModelState is Valid
I've gone through every Stackoverflow thread (and created a couple of my own), and even tried using the ASP.NET Github issues to find a resolution. Anything I try has no effect on the outcome. I'm hoping someone can give me some advice as to what to look
for.
Things I have tried:
* Doing just Redirect() to the URL that should be generated
* Adding a Database and AspNetModule Timeout
* Giving the Application Pool full access to every single folder on IIS