将 DocumentDB 与表单身份验证和角色结合使用

Using DocumentDB with Forms Authentication and Roles

我正在尝试将来自外部身份验证服务的用户数据存储在 DocumentDB 中。成功登录 Google 后,出现此错误:"Unable to find the requested .Net Framework Data Provider. It may not be installed." 我做错了什么?

这是源代码错误:

// Sign in the user with this external login provider if the user already has a login
var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false);
switch (result)
{

部分堆栈跟踪:

[ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.]
System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +948663
System.Data.Entity.Infrastructure.DependencyResolution.DefaultProviderFactoryResolver.GetService(Type type, Object key, Func`3 handleFailedLookup) +84

[ArgumentException: The ADO.NET provider with invariant name 'Microsoft.Azure.Documents.Client' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details.]

以下是我的一些片段 web.config:

<connectionStrings>
    <add name="DefaultConnection" connectionString="AccountEndpoint=[blah]" providerName="Microsoft.Azure.Documents.Client"/>

<system.web>
    <authentication mode="None" />

在使用我的存储库对其他数据执行 CRUD 时,DocumentDB 工作正常。

DocumentDB 没有开箱即用的 membership/role/etc asp.net 提供程序。您需要为其创建自己的自定义提供程序。