使用来自不同网站的服务的 Silverlight RIA 应用程序

发布于 2024-10-25 12:14:06 字数 383 浏览 3 评论 0原文

我有一个 Silverlight 应用程序,它同时使用 RIA 身份验证域服务和 RIA 实体域服务。该应用程序在标准部署方案中运行时可以正常工作,其中 RIA 服务是从下载 Sivlerlight 应用程序的同一 ASP.Net 网站使用的。

为了使我的部署更加灵活,我想使用单独的 Web 应用程序来托管 RIA 服务并托管 Silverlight 应用程序。我已经设法让 RIA 服务在单独的站点中运行,并更新了我的 Silverlight 应用程序以指向它们。问题是身份验证似乎被破坏了。我查看了 fiddler 中的 RIA 请求,身份验证 cookie 似乎是正确的。

是否有人设法部署 Silverlight RIA 应用程序,并将 RIA 服务托管在与下载 Silverlight 应用程序不同的网站上?

I have a Silverlight application that uses both a RIA authentication domain service and a RIA entity domain service. The application works properly when run in a standard deployment scenario where the RIA services are consumed from the same ASP.Net web site that the Sivlerlight app is downloaded from.

In order to make my deployments more flexible I'd like to use separate web applications for hosting the RIA services and to host the Silverlight application. I've managed to get the RIA services working in a separate site and updated my Silverlight application to point to them. The problem is the authentication seems to break. I've looked at the RIA requests in fiddler and the authentication cookies are seemingly correct.

Has anyone managed to deploy a Silverlight RIA application with the RIA services hosted on a web site different to the one the Silverlight app is downloaded from?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

拒绝两难 2024-11-01 12:14:06

编辑:这也不会帮助你。

http://msdn.microsoft.com/en -us/library/ee707359%28v=vs.91%29.aspx

域上下文类包含三个构造函数:

  1. 嵌入了使用 WebDomainClient 类通过 http 与域服务通信所需的 URI。

  2. 允许客户端指定备用 URI 的构造函数。

  3. 允许客户端提供自定义 DomainClient 实现的构造函数(通常用于单元测试或重定向到自定义传输层)。

Edit: this won't help you either.

http://msdn.microsoft.com/en-us/library/ee707359%28v=vs.91%29.aspx

The domain context class contains three constructors:

  1. A default constructor that embeds the URI necessary to communicate with the domain service over http using a WebDomainClient class.

  2. A constructor that permits the client to specify an alternate URI.

  3. A constructor that permits the client to provide a custom DomainClient implementation (typically used for unit testing or redirection to a custom transport layer).

○闲身 2024-11-01 12:14:06

最后,我使用 fiddler 来查看适用于自托管 RIA 服务和外部服务的请求的差异,唯一的区别是 HTTP 引用标头。 RIA RequiresAuthentication 属性考虑引用标头,这似乎很奇怪,所以也许它完全是另一回事。

我找到了一种方法将我的域和身份验证服务整合到一个服务中,并允许它托管在不同的 Web 应用程序上,这非常方便。方法是将 AuthenticationDomainService 放入主域服务中。它不允许在客户端上使用相同的使用模式,身份验证是一个实体加载操作,但它仍然使使用 ASP.Net 成员资格提供程序进行身份验证变得容易。

[EnableClientAccess]
public class MyDomainService : LinqToEntitiesDomainService<MyEntities>, IAuthentication<User>
{
    public class AuthenticationDomainService : AuthenticationBase<User>
    { }

    private AuthenticationDomainService m_authService = new AuthenticationDomainService();

    public User Login(string username, string password, bool isPersistent, string customData)
    {
        return m_authService.Login(username, password, isPersistent, customData);
    }

    ....

In the end the only difference I used fiddler to look at the difference in the requests that were working for a self hosted RIA service and an external one and the only difference was the HTTP referrer header. It would seem strange that the RIA RequiresAuthentication attribute takes the referrer header into account so perhaps it's something else entirely.

I was able to find a way to consolidate my domain and authentication services into a single one and allow it to be hosted on a different web app which is very handy. The approach was to put the AuthenticationDomainService into the main domain service. It doesn't allow the same usage pattern on the client, authentication is an entity load operation, but it does still make it easy to use an ASP.Net membership provider for authentication.

[EnableClientAccess]
public class MyDomainService : LinqToEntitiesDomainService<MyEntities>, IAuthentication<User>
{
    public class AuthenticationDomainService : AuthenticationBase<User>
    { }

    private AuthenticationDomainService m_authService = new AuthenticationDomainService();

    public User Login(string username, string password, bool isPersistent, string customData)
    {
        return m_authService.Login(username, password, isPersistent, customData);
    }

    ....
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文