Click here to Skip to main content
15,892,480 members

wcf Duplex Federated Binding Configurations not working

Member 8706802 asked:

Open original thread
CSS
i am developing a duplex federated wcf service, my federation scenario is working fine but when i tried to make it duplex to an exception is thrown "The incoming policy could not be validated"

i think its issue with my configurations but am still not able to trace out the mistake

Following are my configuration:


1. For my main service:
XML
<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name='MyServiceBehavior'>
                <serviceAuthorization serviceAuthorizationManagerType='MyService.MyServiceAuthorizationManager, My Service' />
                <serviceCredentials>
                    <serviceCertificate storeLocation='LocalMachine'
                                        storeName='My'
                                        x509FindType='FindBySubjectName'
                                        findValue='BookStoreService.com' />
                    <issuedTokenAuthentication>
                        <allowedAudienceUris>
                            <add allowedAudienceUri='http://localhost:53121/MyService.svc/GetResponse'/>
                            <add allowedAudienceUri='http://localhost:53121/MyService.svc/PerformOperation'/>
                        </allowedAudienceUris>
                        <knownCertificates>
                            <add  storeLocation ='LocalMachine'
                                  storeName ='TrustedPeople'
                                  x509FindType ='FindBySubjectName'
                                  findValue ='HomeRealmSTS.com' />
                        </knownCertificates>
                    </issuedTokenAuthentication>
                </serviceCredentials>
                <serviceMetadata httpGetEnabled ='true'/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <bindings>
        <customBinding>
            <binding name='MyServiceBinding'>
                <security authenticationMode='SecureConversation'>
                    <secureConversationBootstrap authenticationMode='IssuedTokenForCertificate'/>
                    <issuedTokenParameters>
                        <issuerMetadata address='http://localhost:62751/TokenIssuer.svc/mex'/>
                    </issuedTokenParameters>
                </security>
                <compositeDuplex/>
                <oneWay/>
                <httpTransport/>
            </binding>
        </customBinding>
    </bindings>
    <services>
        <service name="MyService.MyService"
                           behaviorConfiguration='MyServiceBehavior'>
            <endpoint address="Response"
                                  binding="customBinding"
                                  bindingConfiguration='MyServiceBinding'
                                  contract="MyService.IMyService" />
            <endpoint address="mex"
                      binding="mexHttpBinding"
                      contract="IMetadataExchange" />
        </service>
    </services>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

2. STS Configurations
<pre lang="xml"><system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior>
                <serviceCredentials>
                    <serviceCertificate storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" findValue="HomeRealmSTS.com"/>
                </serviceCredentials>
                <serviceMetadata httpGetEnabled="true"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add scheme="http" binding="wsHttpBinding"/>
    </protocolMapping>
</system.serviceModel>

and 3. Client Configurations
XML
<system.serviceModel>
    <bindings>
        <customBinding>
                <binding name='MyServiceBinding'>
                    <security authenticationMode='SecureConversation'>
                        <secureConversationBootstrap authenticationMode='IssuedTokenForCertificate'/>
                        <issuedTokenParameters>
                            <issuer address='http://localhost:62751/TokenIssuer.svc' binding='wsHttpBinding' bindingConfiguration='MyTokenIssuer'/>
                        </issuedTokenParameters>
                    </security>
                    <compositeDuplex/>
                    <oneWay/>
                    <httpTransport/>
                </binding>
        </customBinding>
        <wsHttpBinding>
            <binding name="MyTokenIssuer">
                <security mode="Message"/>
            </binding>
        </wsHttpBinding>
    </bindings>
    <behaviors>
        <endpointBehaviors>
            <behavior name="GetResponseClientBehavior">
                <clientCredentials>
                    <serviceCertificate>
                        <authentication certificateValidationMode="PeerOrChainTrust"/>
                    </serviceCertificate>
                </clientCredentials>
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <client>
        <endpoint name="WSFederationHttpBinding_IMyService" address="http://localhost:53121/MyService.svc/Response" binding="customBinding" bindingConfiguration="MyServiceBinding" behaviorConfiguration="GetResponseClientBehavior" contract="IMyService">
            <identity>
                <certificateReference storeLocation="CurrentUser" storeName="TrustedPeople" x509FindType="FindBySubjectName" findValue="BookStoreService.com"/>
            </identity>
        </endpoint>
    </client>        
</system.serviceModel>
Tags: XML, WCF

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900