简体   繁体   中英

Using Fiddler and web REST API

Previously I wrote a web REST API using C# with Visual Studio 2019. It was connecting via HTTP and not HTTPS. To debug it, I used Fiddler with the composer and sent a POST to the API and then looked at the response. I am now trying to do the same thing except it is an HTTPS request. Since I have successfully done this with HTTP, I am 99% sure I have everything correct (URL, request body, API, etc.). The problem is that I immediately receive an error.

502 - [Fiddler] The connection to 'localhost' failed.
System.Security.SecurityException Failed to negotiate HTTPS connection with server.fiddler.network.https> HTTPS handshake to localhost (for #63) failed. System.IO.IOException Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. < An existing connection was forcibly closed by the remote host.

I am pretty sure this has something to do with some type of certificate but my knowledge of HTTPS and certificates is VERY limited. I understand the concept but very little more. Can some one point me in the right direction for getting the config correct so the two can talk? If I have right keywords, I can go digging but I don't know what is wrong so I don't know what to search for.

I just found part of my answer on this page - Enable SSL in Visual Studio . I will say that I'm not 100% sure this is all that was needed. I've fought with this for a while so I might have done some other needed certificate stuff along the way and not realized it was also needed. Someday I will start with a fresh Windows install and do just the instructions in the link and will this update this with the results.

I have also learned that, generally speaking, there is really no difference between an HTTP and an HTTPS REST API program from a development point of view. Using the info in the above link, I took an exiting project that I had written for HTTP and flipped the SSL and change the web address (all included in the link) and it ran with an HTTPS connection.

Now if I can only figure out how to change the SSL URL to what I want so I can remember it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM