C# 为Web Api绕过本地网络中的SSL
我有两个网站安装在IIS 10下的同一台服务器上,其中一个是主Web应用程序,另一个是其他服务和我的Web应用程序之间的通信桥梁。对于通信,我使用Web API将数据从传入服务传输到Web应用程序 下面是我传输数据的代码:C# 为Web Api绕过本地网络中的SSL,c#,asp.net-web-api,C#,Asp.net Web Api,我有两个网站安装在IIS 10下的同一台服务器上,其中一个是主Web应用程序,另一个是其他服务和我的Web应用程序之间的通信桥梁。对于通信,我使用Web API将数据从传入服务传输到Web应用程序 下面是我传输数据的代码: var client = new RestClient(url); var request = new RestRequest(Method.POST); request.AddH
var client = new RestClient(url);
var request = new RestRequest(Method.POST);
request.AddHeader("userId", userId);
request.AddHeader("sign", SignDataExtension.CreateSign(signKey, string.Join("*", strSign)));
request.AddHeader("json", json.Base64Encode());
response = client.Execute(request);
url
是本地地址。类似于https://192.168.1.10/api/~
。
主Web应用程序配置为使用Web配置中的rewrite
将任何HTTP重定向到HTTPS
<rewrite>
<rules>
<rule name="asnaf" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Found" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
</rule>
</rules>
</rewrite>
问题是:当我禁用重定向到HTTPS时,数据正在传输,但当HTTPS打开时,我得到的对象引用没有设置为对象的实例。
我如何解决这个问题