WCF WFサービスにアクセスしようとしたときに、同じ権限でSSL/TLSのセキュリティで保護されたチャネルを確立できませんでした。WCF WFサービス、権限を持つSSL/TLS用のセキュリティで保護されたチャネルを確立できませんでした
私はたくさんのstackoverflow/googleソリューションを試しましたが、これまでのところ運がありません。
証明書を使用して検証する第三者に接続するWCF WFサービスを作成しました。私のWeb.configファイルには、次のようになります。
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" strict="false" explicit="true"
targetFramework="4.5.1"/>
<httpRuntime targetFramework="4.5.1"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpsBinding>
<binding name="binding1">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="Certificate" />
</security>
</binding>
</basicHttpsBinding>
</bindings>
<client>
<!-- Test Endpoint -->
<endpoint address="https://example.com"
behaviorConfiguration="endpointBehavior"
binding="basicHttpsBinding"
bindingConfiguration="binding1"
contract="ContractPortType"
name="Port">
</endpoint>
</client>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="endpointBehavior">
<clientCredentials>
<clientCertificate findValue="SOMETHUMBPRINT"
storeLocation="LocalMachine"
storeName="My"
x509FindType="FindByThumbprint" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true"
minFreeMemoryPercentageToActivateService="1"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
クライアントがこれを実行しているだけのシンプルなコンソールです:
using (var client = new ServiceClient())
{
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
var msg = client.GetData();
Console.WriteLine(msg);
}
次のApp.configがあります
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService"/>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:55670/GetData.xamlx"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
contract="Reference.IService" name="BasicHttpBinding_IService" behaviorConfiguration="endpointBehavior" />
</client>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="endpointBehavior">
<clientCredentials>
<clientCertificate findValue="SOMETHUMBPRINT"
storeLocation="LocalMachine"
storeName="My"
x509FindType="FindByThumbprint" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
誰かが私を助けることができれば素晴らしいだろう。
EDIT: 私は働くことができないことは、私のWCF WFサービスとthirdpartyサービスの間に必要なSSL接続です。クライアントからthirdpartyサービスを直接呼び出すと、System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12を設定できます。 私はWCF WFサービスで同じことをする方法を見つけることができません。
編集: だから私はそれを動作を作成してから、そのアクティビティを呼び出してからthirdpartyアクティビティを呼び出してから動作させることで動作させることができますが、より良い方法が必要です。
public sealed class SetTlsVersion : CodeActivity
{
protected override void Execute(CodeActivityContext context)
{
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
}
}
あなたは(svctraceviewer.exe)をトレースWCFを使用してみましたか? https://docs.microsoft.com/en-us/dotnet/framework/wcf/diagnostics/tracing/index – Yaniv
@Yaniv私はそれを見てくれます。チップのおかげで – e11en
@ Yanivはトレースを使って賢くなっていませんすべてのエラーは同じです "権限を持つSSL/TLSのセキュリティで保護されたチャネルを確立できませんでした" – e11en