-
Notifications
You must be signed in to change notification settings - Fork 312
Warning causing OPTIONS request to return as 502 #782
Comments
I've asked @CesarBS to investigate. |
@severisv Could you share more information on what else is in your request path? I've tried reproing with the template MVC app and an empty app with no success. I'm always getting a 204 response. |
I have stripped our project down to a minimal setup that reproduces the issue and pushed it here: https://github.com/severisv/aspnetcore-rc2-cors-issue. Note that the requests to non-existing endpoints also return 502.3 rather than 404. |
@CesarBS Did you get a chance to look into this? |
@severisv The problem is here: This causes
To mitigate this you should do what we do in loggers that don't support scopes e.g.: @Tratcher I think this warrants a defensive fix in |
|
Thanks! |
After upgrading from RC1 to RC2 our OPTIONS-requests (used for CORS) return 502 instead of 204, causing them not to work.
As it turns out, this is caused by a NullReferenceException at AspNetCore.Hosting.Internal.HostingApplication.DisposeContext().
The warning occours at every request, but requests returned by the MVC-pipeline return with the correct status code, while the requests that do not hit any route in the MVC-pipeline or are returned by the CORS-middleware return as 502. The IIS-logs tell us it is a 502.3 occuring in the AspNetCore-module.
Adding
app.UseDatabaseErrorPage()
causes the warning to disappear and everything to work correctly, but this is obvously not a viable solution for a production environment.Here is a gist of our project.json
stdout log:
IIS-trace: https://drive.google.com/folderview?id=0B7YqWm3lf4vZMmNvdFpKZ2lxNGc&usp=sharing
The text was updated successfully, but these errors were encountered: