gpt4 book ai didi

c# - 将 net.tcp 用于 STS 的问题

转载 作者:太空宇宙 更新时间:2023-11-03 16:52:44 26 4
gpt4 key购买 nike

当我尝试使用 STS 引用访问 WCF 端点时,我不断收到以下错误...

Incoming policy failed validation. No valid claim elements were found in the policy XML.

以下是 STS 和 WCF Web 服务的 Web 配置....

STS 网络配置...

<?xml version="1.0" encoding="UTF-8"?>

<configuration>
<appSettings>
<add key="IssuerName" value="ActiveSTS"/>
<add key="SigningCertificateName" value="CN=STSTestCert"/>
<add key="EncryptingCertificateName" value="CN=DefaultApplicationCertificate"/>
</appSettings>

<connectionStrings />

<location path="FederationMetadata">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>

<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<authentication mode="None"> </authentication>

<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</controls>
</pages>
</system.web>

<system.web.extensions>
<scripting>
<webServices />
</scripting>
</system.web.extensions>

<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<diagnostics>
<messageLogging
logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logEntireMessage="true"
logMessagesAtTransportLevel="true"/>
</diagnostics>

<services >
<service behaviorConfiguration="ServiceBehavior"
name="Samples.Security.STS.SecurityTokenService">
<!-- Mutual X509 Endpoint -->

<endpoint
binding="customBinding"
address=""
bindingConfiguration="MutualCertificateBinding"
contract="Samples.Security.STS.ISecurityTokenService">
</endpoint>

<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8100/sts/" />
</baseAddresses>
</host>
</service>
</services>

<bindings>
<customBinding>
<binding name="MutualCertificateBinding">
<security allowInsecureTransport="true" securityHeaderLayout="Lax" enableUnsecuredResponse="true" >
</security>
<binaryMessageEncoding/>
<tcpTransport />
</binding>
</customBinding>
</bindings>


<behaviors >
<serviceBehaviors>

<behavior name="ServiceBehavior">

<serviceMetadata httpGetEnabled="True" httpGetUrl="http://localhost:8831/sts/" />


<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>

</system.serviceModel>

</configuration>

WCF 网络配置...

<?xml version="1.0"?>
<configuration>
<configSections>
<section name="microsoft.identityModel" type="Microsoft.IdentityModel.Configuration.MicrosoftIdentityModelSection, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<location path="FederationMetadata">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<federatedServiceHostConfiguration />
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials>
<serviceCertificate findValue="A3A4D95F1E40D274541EF53D5C9B672F00F41B36" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true" />
<extensions>
<behaviorExtensions>
<add name="federatedServiceHostConfiguration" type="Microsoft.IdentityModel.Configuration.ConfigureServiceHostBehaviorExtensionElement, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</behaviorExtensions>
</extensions>
<protocolMapping>
<add scheme="http" binding="ws2007FederationHttpBinding" />
</protocolMapping>
<bindings>
<customBinding>
<binding>
<security allowInsecureTransport="true" securityHeaderLayout="Lax" enableUnsecuredResponse="true">
</security>
<binaryMessageEncoding />
<tcpTransport />
</binding>
</customBinding>
<ws2007FederationHttpBinding>
<binding>
<security mode="Message">
<message>
<issuerMetadata address="http://localhost:11558/JonsFoodInformationService_STS/Service.svc/mex" />
<claimTypeRequirements>
<add claimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" isOptional="true" />
<add claimType="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" isOptional="true" />

</claimTypeRequirements>
</message>
</security>
</binding>
</ws2007FederationHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<microsoft.identityModel>
<service>
<audienceUris>
<add value="http://localhost:15796/FoodOfTheMonthService.svc" />
</audienceUris>
<issuerNameRegistry type="Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<trustedIssuers>
<add thumbprint="2ABE4F1A98C12363F3A654E76F211F62895DBE65" name="net.tcp://localhost:8000/sts/Service.svc" />
</trustedIssuers>
</issuerNameRegistry>
</service>
</microsoft.identityModel>
<appSettings>
<add key="FederationMetadataLocation" value="C:\JonsAttempt - Try 5 WOrked - Copy\JonsFoodInformationService_STS\FederationMetadata\2007-06\FederationMetadata.xml" />
</appSettings>
</configuration>

非常感谢任何帮助!

最佳答案

这通常意味着,STS 不提供访问目标服务所需的声明。

关于c# - 将 net.tcp 用于 STS 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3355625/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com