【问题标题】:How do I host an active STS in ASP.NET MVC 4?如何在 ASP.NET MVC 4 中托管活动 STS?
【发布时间】:2013-04-17 00:51:11
【问题描述】:

我正在尝试在我的 ASP.NET MVC 4 站点中托管一个主动 STS 端点(它已经成功地托管了一个被动 STS 端点)。出于某种原因,WCF 运行时似乎没有“处理”对我的服务 URI 的调用。

在我的 RouteConfig.cs 文件中,我有这个:

routes.Add(new ServiceRoute("tokens", new MyTokenServiceHostFactory(), typeof(MyTokenServiceConfiguration)));

我相信,这是在没有 .svc 文件的情况下托管服务的正确方法。在我的 web.config 文件中,我有这个:

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <!--(behaviors etc)-->
    <services>
        <service name="System.ServiceModel.Security.WSTrustServiceContract">
            <endpoint address="" binding="ws2007HttpBinding" contract="System.ServiceModel.Security.IWSTrust13SyncContract"/>
        </service>
    </services>
</system.serviceModel>

这块配置可以成功用于自托管服务,我唯一改变的是端点的地址。

当我尝试调用服务时,我得到:

System.ServiceModel.Security.MessageSecurityException:从另一方收到不安全或安全错误。有关故障代码和详细信息,请参阅内部 FaultException。 ---> System.ServiceModel.FaultException:无法处理消息。这很可能是因为操作“http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue”不正确,或者因为消息包含无效或过期的安全上下文令牌,或者因为绑定之间不匹配。

登录的服务跟踪是:

System.ServiceModel.EndpointNotFoundException 没有频道可以接受带有“http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue”操作的消息。

我在这里做错了什么?

【问题讨论】:

    标签: wcf asp.net-mvc-4 wif sts-securitytokenservice


    【解决方案1】:
    【解决方案2】:

    使用标准 ASP.NET 提供程序的 ASP.NET MVC 4.5 中基于声明的身份,

    http://chris.59north.com/post/2013/03/27/Claims-based-identities-in-ASPNET-MVC-45-using-the-standard-ASPNET-providers.aspx

    使用 VS2012 & ASP.NET MVC 构建一个简单的自定义 STS

    http://chris.59north.com/post/2013/04/09/Building-a-simple-custom-STS-using-VS2012-ASPNET-MVC.aspx

    【讨论】:

      猜你喜欢
      • 2017-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-09
      • 2023-03-27
      • 1970-01-01
      相关资源
      最近更新 更多