How do I add SSL to a .net application that uses httplistener - it will *not* be running on IIS

前端 未结 6 1174
無奈伤痛
無奈伤痛 2020-12-12 20:57

Most recent edits in bold I am using the .net HttpListener class, but I won\'t be running this application on IIS and am not using ASP.net. Th

6条回答
  •  有刺的猬
    2020-12-12 21:13

    The class documentation

    has this note:

    If you create an HttpListener using https, you must select a Server Certificate for that listener. Otherwise, an HttpWebRequest query of this HttpListener will fail with an unexpected close of the connection.

    and this:

    You can configure Server Certificates and other listener options by using HttpCfg.exe. See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/http/http/httpcfg_exe.asp for more details. The executable is shipped with Windows Server 2003, or can be built from source code available in the Platform SDK.

    Is the first note explained by the second? As outlined in the question, I used httpcfg.exe to bind the certificate to a specific port. If they intend something other than this, the note is ambiguous.

提交回复
热议问题