質問 1: コンピュータを再起動せずに setspn.exe を有効にする方法はありますか?
質問 2: SPN を設定し、サーバー上で WCF サービスを実行しました。クライアントは Kerberos を使用して接続し、クライアント側で Identity 要素を変更して再試行しました。Kerberos の代わりに NTLM を使用していることがわかりましたが、これで問題ありません。
WCF サービス構成ファイルで SPN を変更し、(登録された SPN を変更せずに) サービスを再実行したところ、クライアント側で Kerberos 認証が使用されていることがわかりました。WCF サービスの ID 要素を変更しても効果がないのはなぜですか? どうすればいいの?
注:認証を確認するためにフィドラーを使用しています。
サーバー側の設定ファイル:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
<services>
<service name="WcfServiceLibrary1.Service1">
<host>
<baseAddresses>
<add baseAddress = "https://FQDN:PORT/TESTSVC/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="service_binding" contract="WcfServiceLibrary1.IService1">
<identity>
<servicePrincipalName value="svc1/FQDN:PORT" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="service_binding">
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpsGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
クライアント側の設定ファイル:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService1">
<security mode="Transport" />
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://FQDN:PORT/TESTSVC/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1"
contract="ServiceReference1.IService1" name="WSHttpBinding_IService1">
<identity>
<servicePrincipalName value="ismine/nhdc1.nhandal2.local:8730" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>