私はWCFから始めており、MSDNのサンプルに従っています。はじめにのサンプルを1台のマシンで実行し、クライアントとサービスを別のマシンにデプロイして、サービスにリモートアクセスすることに成功しました。
私の目標は、パブリッシュ/サブスクライブデザインパターンを実装することです。大きな問題もなく、1台のマシンで実行できました。しかし、クライアントとサービスを別のマシンにデプロイしていると、クライアントがサービスに接続できません。次の例外が発生します。
System.ServiceModel.Security.SecurityNegotiationException was unhandled
Message=The caller was not authenticated by the service.
Source=mscorlib
(必要に応じてスタックトレースを共有できます。)
これが私の構成です:
サービス-web.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<protocolMapping>
<add scheme="http" binding="wsDualHttpBinding"/>
</protocolMapping>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
クライアント-app.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_ISampleContract" clientBaseAddress="http://<SERVICE MACHINE PUBLIC IP>:8000/myClient/"
closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default"/>
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://<SERVICE MACHINE PUBLIC IP>/ServiceModelSamples/service.svc"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_ISampleContract"
contract="ISampleContract" name="WSDualHttpBinding_ISampleContract">
<identity>
<servicePrincipalName value="host/<SERVICE MACHINE PUBLIC IP>" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
私は解決策を探しましたが、何もうまくいきませんでした。私はサービス側でセキュリティ/認証を無効にする方法を見つけようとしましたが(それを機能させるためだけに)、それでも成功しませんでした。
どうすればこれを修正できますか?