When using HTTPS with IISExpress 10 and VS2015 web api controllers will not send back the ReasonPhrase for a HttpResponseMessage. If I connect through HTTP it works fine, but HTTPS just clears out the reasonphrase. When deployed to azure this doesn't happen (https works as expected), it only happens on my local machine.
You can reproduce this by making a new mvc app with web api support, framework 4.5.2. Create a new web api controller (it will do the same thing with an mvc controller and HttpStatusCodeResult) and add a post command such as:
public HttpResponseMessage Post()
{
var ret = new HttpResponseMessage((HttpStatusCode)270) { ReasonPhrase = "Test reason phrase", Content = new StringContent("test content") };
return ret;
}
I used postman to test it. Over http the status will be
270 Test reason phrase
over HTTPS it will just be
270 OK
You can set a breakpoint and see that ret is being set correctly regardless of where the request comes from, so something in IIS is overriding the ReasonPhrase on HTTPS.
I have tried setting httpErrors in the web.config to pretty much every combination for errorMode and existingResponse. My machine.config (for any version of .net) is not set to retail anywhere. The application.config inside .vs has httpErrors set to overrideModeDefault="Allow".
I cannot think of nor find any other suggestions for settings to modify. Is this just a bug/limitation of iisexpress? Or is there some magic setting I'm missing?
Update:
I made a VM with windows 10 and VS2015 to test. Same results. I also enabled IIS (normal IIS) on the VM and published to it. Same results in that as well.
I also changed the Status Code to 570 just for fun and that gives same results, "570 OK" which I find funny because 5xx is not considered a success code so I would have expected something different than OK.