C# WCF客户端错误:";未指定安全令牌颁发者的地址";
我从我的WCF客户端收到以下错误。“未指定安全令牌颁发者的地址。必须在目标服务器的绑定中指定显式颁发者地址。”http://site.com/TLAPI.svc'或必须在凭据中配置本地颁发者地址。' 我正在尝试连接到SharePoint Service应用程序。我在下面添加了生成客户机类的服务引用。以下是我迄今为止的代码:C# WCF客户端错误:";未指定安全令牌颁发者的地址";,c#,wcf,sharepoint,service-application,C#,Wcf,Sharepoint,Service Application,我从我的WCF客户端收到以下错误。“未指定安全令牌颁发者的地址。必须在目标服务器的绑定中指定显式颁发者地址。”http://site.com/TLAPI.svc'或必须在凭据中配置本地颁发者地址。' 我正在尝试连接到SharePoint Service应用程序。我在下面添加了生成客户机类的服务引用。以下是我迄今为止的代码: TipAndLeadAPIContractClient client = new TipAndLeadAPIContractClient(@"CustomBinding_IT
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>
下面是我的服务应用程序绑定配置:
<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>
提前感谢。绑定是使用IssuedToken凭据类型设置的:
除了地址之外,您还需要指定绑定类型,该绑定类型应与任何定制配置一起使用,您可能需要与STS进行对话。您有关于如何创建安全令牌服务器的好网站或文献吗?这里有一篇关于MSDN的非常好的文章[1],详细介绍了如何使用“日内瓦”框架来构建自定义STS。当然,这比没有“日内瓦”要容易得多,所以我建议走这条路。[1] 没有更新版本了吗?这是从2008年开始的,很多组件都过时了。当我引用较新的程序集时,我对代码进行了大量修改,并出现了大量生成错误。您可以通过MSDN上的标识管理中心找到大量信息:您是否正在使用STS取决于您正在使用的服务。如果服务被定义为获取令牌,那么必须已经有一个STS,该服务将使用它。作为编写客户机的人,您不应该担心实现自己的STS。如果您拥有该服务,并且不想使用已颁发的令牌,那么只需将该服务的安全方案更改为UsernameOverTransport或其他内容。