Silverlight的WSTrustClient返回Not Found [英] WSTrustClient from Silverlight returns Not Found

查看:80
本文介绍了Silverlight的WSTrustClient返回Not Found的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个SL客户端和一个WCF服务,它与StarterSTS一起使用WSTrustClient进行用户名/密码验证。 我运行了FedUtil,生成了federationmetadata.xml文件,并将WCF服务作为RP添加到ADFSv2。 我不得不合并
WIF配置代码,目前有两个单独的< service>配置文件中的条目 - 也许它应该是1? 或者也许没关系。


在我的SL客户端中,我点击两个按钮之一,用户名或Windows身份验证。 当我点击Windows Auth时,我创建了一个WSTrustClient实例,如下所示:


 < span style ="color:blue"> private  WSTrustClient GetWindowsWSTrustClient()

{

var client = new WSTrustClient(

new WSTrustBindingWindows(),

new EndpointAddress((" https://sp2010server.sp2010.local/adfs/services/trust / 13 / windowstransport" )),

new WindowsCredentials());



return 客户;

}



然后我创建RST请求 - 如何在ADFSv2中使用EndpointAddress?


  var  rst =  new  RequestSecurityToken(WSTrust13Constants.KeyTypes.Symmetric)

{

AppliesTo = new EndpointAddress(" https://sp2010server.sp2010.local/HelloWorldService/Service1.svc/Win"

我的绑定,由FedUtil生成(接受我试过关闭EstablishSecurityContext)如下


 

 <   system.serviceModel  >  

< < span style ="color:#a31515">服务 < span style ="color:blue">>

< 服务 名称 = " HelloWorldService.Service1 " behaviorConfiguration < span style ="color:blue"> = " starterRP_behavior " >

< 端点 地址 = " Win " binding = " ws2007FederationHttpBinding " 合同 = " HelloWorldService.IService1 " bindingConfiguration = " < span style ="color:blue"> HelloWorldService.IService1_ws2007FederationHttpBinding " />

< 端点 绑定 = " ws2007FederationHttpBinding " bindingConfiguration = &现状t; mixedNoSession " bindingName = " MixedSecurityBindingNoSession " 合同 = " HelloWorldService.IService1 " />

< / 服务 >

< / 服务 >

< bindings >

< ws2007FederationHttpBinding >

< binding name = " mixedNoSession " >

< 安全性 模式 = " ; TransportWithMessageCredential " >

< 消息 establishSecurityContext = " ; false " >

< issuerMetadata 地址 = " https: //sp2010server.sp2010.local/StarterSTS/users/issue.svc/mex" />

< / 消息 >

< / 安全性 >

< / 绑定 >

< < span style ="colo r:#a31515">绑定 名称 = " HelloWorldService.IService1_ws2007FederationHttpBinding " >

< 安全 mode = " 消息 " >

< 消息 establishSecurityContext = " false " >

< issuerMetadata 地址 = " https://sp2010server.sp2010.local/adfs/services/trust/mex " />

< claimTypeRequirements >

<! - 以下是STS提供的声明:http://SP2010Server.SP2010.local/adfs/services/trust'。添加或取消注释您的应用程序所需的声明,然后更新此应用程序的联合元数据.-->

< 添加 claimType = " http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name < span style ="color:black">" isOptional = " true " />

< add < span style ="color:red"> claimType = " http://schemas.microsoft.com/ws/2008/06/identity/claims / role " isOptional = " true " < span style ="color:blue"> />

.............

解决方案

SL默认将SOAP故障显示为"未找到"。这通常可以通过切换到SL客户端HTTP堆栈来修复。


I have a SL client and a WCF service that is working with StarterSTS for username/password authentication using WSTrustClient.  I ran FedUtil, generated the federationmetadata.xml file and added the WCF service as a RP to ADFSv2.  I had to merge the WIF configuration code and currently have two separate <service> entries in the config file - maybe it should be 1?  Or maybe it doesn't matter.

In my SL client i click on one of two buttons, username or windows auth.  When I click on Windows Auth I create an instance of WSTrustClient as follows:

        private WSTrustClient GetWindowsWSTrustClient()

        {

            var client = new WSTrustClient(

                new WSTrustBindingWindows(),

                new EndpointAddress(("https://sp2010server.sp2010.local/adfs/services/trust/13/windowstransport")),

                new WindowsCredentials());



            return client;

        }



Then I create the RST request -- how is the EndpointAddress used in ADFSv2?

       var rst = new RequestSecurityToken(WSTrust13Constants.KeyTypes.Symmetric)

       {

           AppliesTo = new EndpointAddress("https://sp2010server.sp2010.local/HelloWorldService/Service1.svc/Win")

       };

my bindings, generated by FedUtil (accept I tried turning off EstablishSecurityContext) are as follows

  <system.serviceModel>

    <services>

      <service name="HelloWorldService.Service1" behaviorConfiguration="starterRP_behavior">

        <endpoint address="Win" binding="ws2007FederationHttpBinding" contract="HelloWorldService.IService1" bindingConfiguration="HelloWorldService.IService1_ws2007FederationHttpBinding" />

        <endpoint binding="ws2007FederationHttpBinding" bindingConfiguration="mixedNoSession" bindingName="MixedSecurityBindingNoSession" contract="HelloWorldService.IService1" />

      </service>

    </services>

    <bindings>

      <ws2007FederationHttpBinding>

        <binding name="mixedNoSession">

          <security mode="TransportWithMessageCredential">

            <message establishSecurityContext="false">

              <issuerMetadata address="https://sp2010server.sp2010.local/StarterSTS/users/issue.svc/mex" />

            </message>

          </security>

        </binding>

        <binding name="HelloWorldService.IService1_ws2007FederationHttpBinding">

          <security mode="Message">

            <message establishSecurityContext="false">

              <issuerMetadata address="https://sp2010server.sp2010.local/adfs/services/trust/mex" />

              <claimTypeRequirements>

                <!--Following are the claims offered by STS 'http://SP2010Server.SP2010.local/adfs/services/trust'. Add or uncomment claims that you require by your application and then update the federation metadata of this application.-->

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

                 .............

解决方案

SL shows SOAP faults by default as "not found". This can be typically fixed by switching to the SL client HTTP stack.


这篇关于Silverlight的WSTrustClient返回Not Found的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆