我有一个c#批处理作业,它调用第三方Web服务方法来提交 数据。代码在本地工作(开发机器),因为下面的行 代码和直接呼叫(中间没有路由服务)到第三方 服务。
批处理作业代码
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
| SecurityProtocolType.Tls11
| SecurityProtocolType.Tls12
| SecurityProtocolType.Ssl3;
当它安装在服务器A(批处理服务器)上时,呼叫通过WCF路由服务B(出站路由器服务),然后到达外部客户端服务。调用没有通过并抛出异常“无法创建SSL / TLS安全通道”
路由服务
<configuration>
<system.web>
<compilation targetFramework="4.5" debug="true"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="routingData">
<serviceMetadata httpGetEnabled="True"/>
<routing routeOnHeadersOnly="false" filterTableName="routingTable1"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IRoutingService" maxReceivedMessageSize="2147483647" sendTimeout="00:02:00"/>
<binding name="BasicHttpBinding_IService1" sendTimeout="00:02:00">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="routingData" name="System.ServiceModel.Routing.RoutingService">
<endpoint address=""
binding="basicHttpBinding"
name="reqReplyEndpoint"
bindingConfiguration="BasicHttpBinding_IRoutingService"
contract="System.ServiceModel.Routing.IRequestReplyRouter" />
<endpoint address="ExternalService"
binding="basicHttpBinding"
name="ExternalService"
bindingConfiguration="BasicHttpBinding_IRoutingService"
contract="System.ServiceModel.Routing.IRequestReplyRouter" />
</Service>
</Services>
<client>
**Modify address to the URL of the Internal Service**
<endpoint name="ExternalWebReference.IJISBroker"
address="https://3rdparty.ExternalWebReference.org:8443/IJISBroker
/resources/Integrator/soapRequest" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="*">
</endpoint>
</client>
**FILTERS**
<routing>
<filters>
<filter name="ExternalFilter" filterType="EndpointName"
filterData="ExternalService" />
</filters
<filterTables>
<filterTable name="routingTable1">
<add filterName="ExternalFilter"
endpointname="ExternalWebReference.IJISBroker" priority="0"/>
</filterTable>
</filterTables>
</routing>
</system.serviceModel>
</configuration>
我真的尝试了几乎所有的东西,但我一直低于错误,
所以现在我怀疑如果我需要添加(ServicePointManager.SecurityProtocol)
路由服务的代码行。因为路由服务只有
web.config,我不知道如何在config中集成或者我需要
写自定义路由器?
**Exception Message :**
Could not create SSL/TLS secure channel
Exception Message: Could not establish secure channel for SSL/TLS with
authority ‘3rdparty.ExternalWebReference.org:8443'.
System.ServiceModel.FaultException`1
[System.ServiceModel.ExceptionDetail]
Could not establish secure channel for SSL/TLS with authority
3rdParty.ExternalWebReference.org:8443'.
您认为此问题可能是由路由服务引起的吗?如果您有任何亲身经历,请分享。