【问题标题】:C# MVC3 - New Membership Providers (System.Web.Providers) and old Membership classes (System.Web.Security)C# MVC3 - 新成员资格提供程序 (System.Web.Providers) 和旧成员资格类 (System.Web.Security)
【发布时间】:2011-09-20 20:11:09
【问题描述】:

当我在本地测试时,我的应用程序运行得非常好,包括会员提供程序和数据库。当我尝试在 Windows Azure 平台上运行它时,我的噩梦就开始了。

从那时起,我阅读了很多关于在 Sql Azure 中运行 aspnet_regsql 以及新的通用成员资格提供程序的文章。但是我无法意识到如何使用新的提供程序,而且我对 System.Web.Providers 和 System.Web.Security 类和方法感到非常困惑。当我尝试使用新 Providers 创建新用户时,创建失败并出现 Null 异常,即使我已放置所有参数并且构建正常。

我的项目已经完全准备好了,我只需要把它上传到主机。

我怎样才能让它轻松地在 Windows Azure 中运行?或者我应该学习如何使用新的通用 Providers 并调整我的所有项目?

【问题讨论】:

    标签: asp.net-mvc-3 asp.net-membership azure-sql-database


    【解决方案1】:

    似乎需要 System.Web.Providers 才能在 Azure 上运行您的应用程序,至少无需任何繁重的代码提升。 Scott Hanselman 在他最近的博客文章中概述了安装和使用 System.Web.Providers 的基础知识:Introducing System.Web.Providers - ASP.NET Universal Providers for Session, Membership, Roles and User Profile on SQL Compact and SQL Azure

    另一个可能有用的资源是 Wade Wegner 的帖子 Deploying the Windows Azure ASP.NET MVC 3 Web Role

    简而言之,在使用 NuGet 在您的项目中安装 System.Web.Providers 后,它将重新配置您的 web.config 以包含两个连接字符串,一个用于 ApplicationServices,另一个用于 DefaultConnection。您需要使用 Azure 连接字符串更新这些内容,但请确保附加“MultipleActiveResultSets=True;”到两个连接字符串。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-04
      • 1970-01-01
      • 1970-01-01
      • 2011-03-19
      • 1970-01-01
      • 1970-01-01
      • 2010-11-15
      • 1970-01-01
      相关资源
      最近更新 更多