I have a WCF service that needs to handle the following :
- 1 Service
- Regular TCP Endpoint
- Secured customUsernamePassword Endpoint
- Secured Windows Endpoint
The system.serviceModel section looks like this :
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<behaviors>
<serviceBehaviors>
<behavior name="AppClientService.CustomValidator_Behavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
<serviceCredentials>
<clientCertificate>
<authentication certificateValidationMode="PeerOrChainTrust" />
</clientCertificate>
<serviceCertificate findValue="MyService" storeLocation="LocalMachine"
storeName="Root" x509FindType="F开发者_Python百科indBySubjectName" />
<userNameAuthentication userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="App.ServiceImplementation.CustomUsernamePasswordValidator, App.ServiceImplementation" />
</serviceCredentials>
<serviceAuthorization principalPermissionMode="Custom" serviceAuthorizationManagerType="App.ServiceImplementation.CustomServiceAuthorizationManager, App.ServiceImplementation">
<authorizationPolicies>
<add policyType="App.ServiceImplementation.CustomAuthorizationPolicy, App.ServiceImplementation" />
</authorizationPolicies>
</serviceAuthorization>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="AppClientService.CustomValidator_Behavior" name="App.ServiceImplementation.AppClientService">
<endpoint binding="netTcpBinding" bindingConfiguration="netTcpRegular" address="Regular" bindingNamespace="http://App.ServiceContracts/2007/11" contract="App.ServiceContracts.IAppClientService" />
<endpoint binding="netTcpBinding" bindingConfiguration="netTcpUserNameMessageSecurity" address="UserName" bindingNamespace="http://App.ServiceContracts/2007/11" contract="App.ServiceContracts.IAppClientService" />
<endpoint binding="netTcpBinding" bindingConfiguration="netTcpWindowMessageSecurity" address="Windows" bindingNamespace="http://App.ServiceContracts/2007/11" contract="App.ServiceContracts.IAppClientService" />
<endpoint address="httpMex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint address="tcpMex" binding="mexTcpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<!-- NET.TCP -->
<netTcpBinding>
<binding name="netTcpUserNameMessageSecurity" portSharingEnabled="True" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="01:00:00" sendTimeout="01:00:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="infinite" enabled="false" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="Windows" />
<message clientCredentialType="UserName" />
</security>
</binding>
<binding name="netTcpWindowMessageSecurity" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="infinite" sendTimeout="01:00:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="infinite" enabled="false" />
<security mode="Message">
<message clientCredentialType="Windows" />
</security>
</binding>
<binding name="netTcpRegular" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="infinite" sendTimeout="01:00:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="infinite" enabled="false" />
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
This works fine with Windows login and CustomUsername Password login, but Im not sure how to get the regular(unsecure) endpoint working?
Pleas Advice
BestRegards
You need to set the security mode to None.
精彩评论