Kestrel HTTPS BadHttpRequestException - https

Over HTTP and inside of Visual Studio it is working fine. However, when I attempt to hit the endpoint over HTTPS I'm seeing this error and I'm not entirely sure how to figure out the problem:
info: Microsoft.AspNetCore.Server.Kestrel[17]
Connection id "0HL36O0ESIPBQ" bad request data: "Invalid request line: <0x16><0x03><0x01><0x00><0x83><0x01><0x00><0x00><0x7F><0x03><0x01>X<0xC1><0x07><0xDC><0x9E>~Y<0x05><0x13><0xC1><0xF4>^J<0xCF><0xAB><0x11><0xC3>R[<0x87><0x1D>..."Microsoft.AspNetCore.Server.Kestrel.BadHttpRequestException: Invalid request line: <0x16><0x03><0x01><0x00><0x83><0x01><0x00><0x00><0x7F><0x03><0x01>X<0xC1><0x07><0xDC><0x9E>~Y<0x05><0x13><0xC1><0xF4>^J<0xCF><0xAB><0x11><0xC3>R[<0x87><0x1D>
Fiddler gives me this:
System.IO.IOException The handshake failed due to an unexpected packet format.
My gut tells me this has to do with moving from dotnet core 1.0.1 to 1.1.0. This was all working fine before that point, but it is equally likely I screwed something else up and I'm just not sure what! :)

I'll add to Paul's hint in the form of an answer.
The .UseHttps class is in the "Microsoft.AspNetCore.Server.Kestrel.Https" module, which can be added by searching for "usehttps" in the Package Manager UI or by adding it to your project.json file. Note that at the time of this writing, version 1.1.1 is now available for ASP.NET Core, so be sure to choose the version you need.
Not sure it will solve my problem, but perhaps it will solve the problem of someone else that reads this.

Ok. I'll answer my own question. It turns out I just needed to add .UseHttps to my WebHostBuilder in program.cs:
.UseKestrel(options =>
{
options.AddServerHeader = false;
options.UseHttps("MyPfx", "MyPassword");
})
I guess I'm a little confused how this was working previously without this but hey, it works now!

Related

How to disable caching from AFNetworking

I'm using AFNetworking 2.0 to receive response from server. For first response, it works fine. However, after I change the data on the admin site, and verify that the change is made in a browser, then I run the app again, but I still get the previous response. I don't understand why? It seems that AFNetworking is caching the old response. I want to download the current feed. Who can help me, please????
I had the exact opposite problem. I was getting the same image from my server twice, AFNetworking wasn't caching. As I debugged it I realized that I was calling 2 slightly different URLs, in one case I was specifying an option that was the default on the server.
So this gave me the idea for a work around hack for you. It isn't the right answer but it should work. Just pass a useless parameter to the server. Change this parameter for each server call.
https://example.com/myrequest?index=0
then
https://example.com/myrequest?index=1
where index is the unused parameter.
Note: this is actually a pretty gross hack, it should get you running but you really should find the "correct" answer.

VB6 Class does not support Automation or does not support expected interface

I have been facing this issue for a couple days now.
It seems that on a client site I am recieving the automation error. The line of code in where im 90% sure it is coming from is below:
Set oTemp = New cPMXMLParser
However in other functions I seen
Set m_oXml = CreateObject("PMXMLParser.cPMXMLParser")
Which is essentialy the same except for the binding.
Please note both works locally but not on client site I was thinking maybe a dependancy is missing but seems not ... does anyone have any information on this?
Would
Set m_oXml = CreateObject("PMXMLParser.cPMXMLParser")
Be the best option?

Handling empty HTTP response with Glimpse

I'm integrating Glimpse to a legacy production application (Upgraded to MVC3). Most pages have a lot of ajax requests and some of the ajax requests return an empty response based on the business logic.
Glimpse client fails to parse such empty responses (out of may be 20-30 responses). Chrome console clearly shows where it fails.
Uncaught TypeError: Cannot call method 'indexOf' of null Glimpse.axd?n=glimpse_client&hash=0a37c827:3633
display.ajax.processContentType Glimpse.axd?n=glimpse_client&hash=0a37c827:3633
display.ajax.update Glimpse.axd?n=glimpse_client&hash=0a37c827:3657
display.ajax.XMLHttpRequest.open
The reason is that the processContentType function is given a 'null' as contentType (variable named 'type' within the function) and the following statement fails.
return type.substring(0, type.indexOf(';'));
What bothers me is the fact that the whole Glimpse window does not show up (Glimpse icon is not hyper-linked to open up the Glimpse tabs) as a result. Is there anyway (configuration?) to workaround the issue?
Thank you!
The issue was resolved by updating Glimpse to 1.5.0.
---Here's the comment from Glimpse;
avanderhoorn commented 6 hours ago
You must be running an old version of Glimpse.core. This was fixed with PR #401 (reported in
#400) and went live in release https://github.com/Glimpse/Glimpse/releases/1.5.0.
All I did was 'Update-Package Glimpse' in VS package manager console and it's fixed now.

POST via $.ajax (with PhoneGap 2.6 and Zepto.js) on Android Woes

I am currently working on a PhoneGap app which is required to POST to a server (running Django). Unfortunately, we are not receiving the anticipated response when we perform this action: We get a 200 message with no data, rather than a 401 (unauthorized) with a json object.
Our javascript code is similar to: this code
The server-side python looks a bit like: this code
Any ideas?
Thank you!
I can not help you with your specific problem, but I can tell you that you will never get a 401 code back.
PhoneGap applications have an issue with it: they return code '0' instead of '401' for some reason. It is on their official JIRA:
PhoneGap JIRA
So whatever you find for solution for your issue, you will just get a new problem.

Spring security login error

I just implemented a simple login functionality using spring it how ever worked with the eclipse in built browser but gives the following error in chrome and firefox.
HTTP Status 404 - /SpringLogin/welcome.jsp;jsessionid=8332D4F3D4709DCA37C87F30F1EA03D5
The requested resource (/SpringLogin/welcome.jsp;jsessionid=BEE789093FF79CB6B67F8DA368E8B3E4) is not available.
can you please tell me why it is happening?
PS: I have two projects SpringLogin and both of them had same project names and both had similar packages. Then neither of the projects worked properly and gave the above error. How ever after I created another project with a different name and using different package names, it worked like magic. I am guessing here that it may have been the problem. But what is the logical answer that'll explain what happened there?
you don't have being calling the correct URL
it seems that the context /SpringLogin/ does not exists anymore.
Try /welcome.jsp or if you changed the name of application - try /newappname/welcome.jsp

Resources