我创建了带有服务的 Web 应用程序,以使用 WS-Trust 协议为某些 Silverlight 应用程序接收声明。我看到声明是在 GetOutputClaimsIdentity() 方法中创建的(称为两次,为什么?),但在 Silverligh 级别我收到“未找到”消息(空流?)。
Silverlight 对 WS-Trust 的支持我从最新的 WIF 培训工具包中获得。我试图在服务器端调试代码,但不幸的是,WIF 源代码还不能作为 .NET Framework 调试的一部分使用 :(
所以我不知道为什么它没有正确地向客户端应用程序发送带有声明的响应。
WS-Trust 项目的 Web.config 文件的内容如下(我目前使用自签名证书):
<?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>
<appSettings>
<add key="IssuerName" value="PatientInfo"/>
<add key="SigningCertificateName" value="CN=PatientInfo"/>
<!--<add key="EncryptingCertificateName" value="CN=DefaultApplicationCertificate"/>-->
<add key="EncryptingCertificateName" value=""/>
</appSettings>
<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"/>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment
aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<ws2007HttpBinding>
<binding name="ws2007HttpBindingConfiguration">
<security mode="TransportWithMessageCredential">
<message establishSecurityContext="false" clientCredentialType="UserName" />
</security>
</binding>
</ws2007HttpBinding>
</bindings>
<services>
<service name="Microsoft.IdentityModel.Protocols.WSTrust.WSTrustServiceContract" behaviorConfiguration="ServiceBehavior">
<endpoint address="IWSTrust13"
binding="ws2007HttpBinding"
bindingConfiguration="ws2007HttpBindingConfiguration"
contract="Microsoft.IdentityModel.Protocols.WSTrust.IWSTrust13SyncContract"/>
<host>
<baseAddresses>
<add baseAddress="https://WIN-8LUMNJ5E6S4/PatientHistInfo.WS-Trust/InternalAuthentication.svc" />
</baseAddresses>
</host>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
<microsoft.identityModel>
<service>
<securityTokenHandlers>
<remove type="Microsoft.IdentityModel.Tokens.WindowsUserNameSecurityTokenHandler, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add type="eSoft.Server.Security.CustomUserNamePasswordTokenHandler, PatientHistInfo.WS-Trust"/>
</securityTokenHandlers>
</service>
</microsoft.identityModel>
<system.diagnostics>
<sources>
<source name="Microsoft.IdentityModel" switchValue="Verbose">
<listeners>
<add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData="WIFTrace.txt" />
</listeners>
</source>
</sources>
<trace autoflush="true" />
</system.diagnostics>
</configuration>
提琴手结果如下:
HTTP/1.1 504 Fiddler - 接收失败内容类型:文本/html 连接:关闭时间戳:15:41:21.666
ReadResponse() 失败:服务器没有为此请求返回响应。
什么会导致这样的问题?