2011-10-10 110 views
4

我從我的WCF客戶端收到以下錯誤。 「未指定安全令牌頒發者的地址,必須在目標'http://site.com/TLAPI.svc'的綁定中指定明確的頒發者地址,或者必須在證書中配置本地頒發者地址。」WCF客戶端錯誤:「未指定安全令牌頒發者的地址」

我正在嘗試連接到SharePoint服務應用程序。我添加了下面生成客戶端類的服務引用。這裏是我的代碼至今:

TipAndLeadAPIContractClient client = new TipAndLeadAPIContractClient(@"CustomBinding_ITipAndLeadAPIContract", @"http://site.com/TLAPI.svc"); 
client.ChannelFactory.Credentials.SupportInteractive = false; 
client.ClientCredentials.UserName.UserName = "user"; 
client.ClientCredentials.UserName.Password = "password"; 
client.ConvertToTLForm(@"C:\Clients\ServiceApplication\CAP\capsample1.xml", "tl_library", "http://site/"); 

這裏是我的客戶端綁定配置:

<binding name="CustomBinding_ITipAndLeadAPIContract"> 
       <security defaultAlgorithmSuite="Default" authenticationMode="IssuedToken" 
        requireDerivedKeys="true" securityHeaderLayout="Strict" includeTimestamp="true" 
        keyEntropyMode="CombinedEntropy" messageProtectionOrder="SignBeforeEncryptAndEncryptSignature" 
        messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" 
        requireSignatureConfirmation="false"> 
        <issuedTokenParameters keyType="SymmetricKey" tokenType="" /> 
        <localClientSettings cacheCookies="true" detectReplays="true" 
         replayCacheSize="900000" maxClockSkew="00:05:00" maxCookieCachingTime="Infinite" 
         replayWindow="00:05:00" sessionKeyRenewalInterval="10:00:00" 
         sessionKeyRolloverInterval="00:05:00" reconnectTransportOnFailure="true" 
         timestampValidityDuration="00:05:00" cookieRenewalThresholdPercentage="60" /> 
        <localServiceSettings detectReplays="true" issuedCookieLifetime="10:00:00" 
         maxStatefulNegotiations="128" replayCacheSize="900000" maxClockSkew="00:05:00" 
         negotiationTimeout="00:01:00" replayWindow="00:05:00" inactivityTimeout="00:02:00" 
         sessionKeyRenewalInterval="15:00:00" sessionKeyRolloverInterval="00:05:00" 
         reconnectTransportOnFailure="true" maxPendingSessions="128" 
         maxCachedCookies="1000" timestampValidityDuration="00:05:00" /> 
        <secureConversationBootstrap /> 
       </security> 
       <binaryMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" 
        maxSessionSize="2048"> 
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
         maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
       </binaryMessageEncoding> 
       <httpTransport manualAddressing="false" maxBufferPoolSize="524288" 
        maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous" 
        bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
        keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous" 
        realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" 
        useDefaultWebProxy="true" /> 
      </binding> 

這裏是我的服務應用綁定配置:

 <binding name="CalcServiceHttpBinding"> 

     <security authenticationMode="IssuedToken" allowInsecureTransport="true" /> 

     <binaryMessageEncoding> 

     <readerQuotas maxStringContentLength="1048576" maxArrayLength="2097152" /> 
     </binaryMessageEncoding> 
     <httpTransport maxReceivedMessageSize="2162688" authenticationScheme="Ntlm" useDefaultWebProxy="false" /> 
    </binding> 

在此先感謝。

回答

4

的結合是建立與IssuedToken憑據類型:

<issuedTokenParameters keyType="SymmetricKey" tokenType="" /> 

首先,我不知道爲什麼你tokenType屬性是空白。這應該設置爲要協商的令牌類型,例如SAML令牌,例如tokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1"

下一個節點有一個名爲<issuer>的子節點,它允許您指定客戶端應用來協商令牌的安全令牌服務器(STS)的地址。你得到的例外是告訴你,這個具體沒有配置。一個<issuer>元素可能看起來像這樣。

<issuer address="https://someserver/SomeSTS" binding="<some binding type>" bindingConfiguration="<some binding configuration for the STS>" /> 

除了你要指定應與您可能需要能夠與STS談任何自定義配置一起使用綁定類型的地址。

+0

您是否有任何關於如何創建安全令牌服務器的好網站或文獻? –

+1

這裏有一篇很好的文章[1],詳細介紹瞭如何使用「日內瓦」框架構建自定義STS。沒有「日內瓦」的話,肯定會比以前更容易,所以我建議走這條路。 [1] http://msdn.microsoft.com/en-us/magazine/dd347547.aspx –

+0

沒有更新的版本?它是從2008年開始的,許多組件都過時了。當我參考較新的程序集時,我已經修改了很多代碼,並且發現了很多構建錯誤。 –

相關問題