最後我用小提琴手來看看這是工作了自我要求的差異,唯一的區別託管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);
}
....
不確定這適用於單獨的Web項目。 http://www.blogs.victorero.com/2010/04/20/CreatingASilverlightApplicationWithAWCFRIAServicesClassLibrary.aspx – 2011-03-24 00:57:19
它不適用。我已經在Silverlight客戶端中提供了我的RIA服務類。 – sipwiz 2011-03-24 01:04:24