私を助けてください。netTcpBinding とセキュリティmode="Message"
メッセージを使用してサービスを作成しますclientCredentialType="UserName"
。これが私の設定です
<system.serviceModel>
<client>
<endpoint address="http://topaznet.hq.eximb.com/RS/Svc/RS.svc"
binding="wsHttpBinding" bindingConfiguration="wsHttpBindingEndpoint"
contract="RSClient.IRS" name="wsHttpBindingEndpoint" />
</client>
<services>
<service behaviorConfiguration="CredoServiceBehavior" name="CredoService.Credo">
<endpoint address="" binding="netTcpBinding" name="netTcpBindingEndpoint"
contract="CredoService.ICredo" />
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange" endpointConfiguration="" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost/CredoService/" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="netTcpBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Message">
<message clientCredentialType="UserName"/>
</security>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="CredoServiceBehavior">
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="CredoService.Common.CustomUserNameValidator, CredoService"/>
<serviceCertificate storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" findValue="91797E67B20D0853A90CA8E228AF460A382ED94B" />
<windowsAuthentication allowAnonymousLogons="true"/>
</serviceCredentials>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentSessions="2147483647" maxConcurrentInstances="2147483647"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
サービスは IIS でホストされ、正常に動作します。新しい Windows フォーム プロジェクトを作成し、[サービス参照の追加] をクリックします。構成用にビジュアル スタジオが生成します。
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="netTcpBindingEndpoint1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost/CredoService/Credo.svc"
binding="netTcpBinding" bindingConfiguration="netTcpBindingEndpoint"
contract="CredoClient.ICredo" name="netTcpBindingEndpoint">
<identity>
<servicePrincipalName value="host/home" />
</identity>
</endpoint>
</client>
</system.serviceModel>
この Web 構成では:
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
しかし、私のサービスでは
<security mode="Message">
<message clientCredentialType="UserName"/>
</security>
このクライアントを変更すると、動作せず、例外がスローされます。どうすればこれを修正できますか?