c# - WCF 客户端错误 : "The address of the security token issuer is not specified"

标签 c# wcf sharepoint service-application

我从我的 WCF 客户端收到以下错误。 “未指定安全 token 颁发者的地址。必须在目标 'http://site.com/TLAPI.svc' 的绑定(bind)中指定明确的颁发者地址,或者必须在凭据中配置本地颁发者地址。”

我正在尝试连接到 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/");

这是我的客户端绑定(bind)配置:

 <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>

这是我的服务应用程序绑定(bind)配置:

        <binding name="CalcServiceHttpBinding">

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

      <binaryMessageEncoding>

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

提前致谢。

最佳答案

绑定(bind)是使用 IssuedToken 凭证类型设置的:

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

首先,我不确定为什么你的 tokenType属性为空。这应该设置为将要协商的 token 类型,例如 SAML token tokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1"例如。

下一个节点有一个名为 <issuer> 的子节点它允许您指定客户端用于协商 token 的安全 token 服务器 (STS) 的地址。您得到的异常是告诉您这没有具体配置。一个<issuer>元素可能看起来像这样。

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

除了地址之外,您还需要指定绑定(bind)类型,绑定(bind)类型应该与您可能需要能够与 STS 对话的任何自定义配置一起使用。

关于c# - WCF 客户端错误 : "The address of the security token issuer is not specified",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7716218/

相关文章:

c# - Entity Framework 与 SQLite 错误 : An error occurred while reading from the store provider's data reader

c# - Oracle.DataAccess.Client.BulkCopy - 试图在不应该将 varchar2 转换为数字

javascript - Sharepoint 窗口滚动不触发

c# - 合并 2 个集合

c# - 如何在 WPF DataTemplate 上使用 DataType 属性?

c# - 将继承类返回到基类 WCF 服务

c# - 使用来自 WCF 客户端的非 wcf SOAP 错误(已定义 soap 错误)

javascript - 重新使用 SAML token ,JSON Web 服务的客户端 - 登录网站后

c# - 解决 Sharepoint 中的 'File specified in the modules section of this template already exists.' 错误

可视化 Web 部件中的 JQuery SharePoint Foundation