假设您有两个应用程序 A 和 B,在同一 Web 服务器上运行。您希望应用程序 A 通过 SSL 调用应用程序 B 上的 webService。
是否可以使用类似的地址来做到这一点https://localhost/appsB/webService1?
如何在没有客户端(如浏览器)的情况下完成 SSL 握手?它实际上在使用此地址时有效http://localhost/appsB/webService1,只是在 SSL 模式下不起作用。
然而,在调用时,它可以与服务器和浏览器之间的 HTTPS 配合使用https://localhost/appsB/webService1。
现在,奇怪的是,它有时可以工作,但在使用 HTTPS 调用应用程序 B 上的 webService 时会随机失败。使用HTTP它总是有效的。
我的测试是在 IIS7.0 上进行的,具有来自 Thawte 的有效 ssl 证书,并且应用程序 B 不需要 SSL 选项。
这是我的代码的示例:
string baseAddress = "http://localhost";
//or string baseAddress = "https://localhost";
var baseUri = new Uri(baseAddress);
//final url for appB
finalUrl = baseAddress + httpContext.Current.Request.ApplicationPath.TrimEnd('/') + "/" + url;
//Add a cookie to retrieve good …Run Code Online (Sandbox Code Playgroud)