简体   繁体   English

如何设置新的成员资格和会话提供程序以在Windows Azure中运行? 使用MVC3和Web角色

[英]How to set up new Membership and Session providers to run in Windows Azure? Using MVC3 and Web Role

I've read about the New Membership and Session providers, and the information in this article is that just changing the connectionStrings the database would build itself magically in my SQL Azure Database. 我已经阅读了有关新成员资格和会话提供程序的信息, 本文中的信息只是更改了connectionStrings数据库将在我的SQL Azure数据库中神奇地构建自己。

So, I first changed my connection to: 所以,我首先将我的连接更改为:

<add name="Project" connectionString="Server=tcp:xxxxxxxx.database.windows.net,xxxx;Database=xxxxx;User ID=xxxxxxxxxxx;Password=xxxxxxxxxxx;Trusted_Connection=False;Encrypt=True;" providerName="System.Data.SqlClient" />

When I tried to debug my app with the emulator, I got the error: EFProviders require MultipleActiveResultSets=True for System.Data.SqlClient connection strings. 当我尝试使用模拟器调试我的应用程序时,我收到错误:EFProviders要求System.Data.SqlClient连接字符串的MultipleActiveResultSets = True。

I researched about this error and realized that it was something related to Entity Framework. 我研究了这个错误并意识到它与Entity Framework有关。 I tried to make an Entity Framework connection string with no success. 我试图创建一个Entity Framework连接字符串,但没有成功。 In addtion, I read somewhere that SQL Azure doesn't support MultipleActiveResultSets. 另外,我在某处读到SQL Azure不支持MultipleActiveResultSets。

So, I have 2 questions: 所以,我有两个问题:

  1. Is it true that if I run the application and register any user via website interface the Membership and Session tables, views and procedures will magically build in my SQL Azure database? 是否真的如果我运行应用程序并通过网站界面注册任何用户,会员和会话表,视图和程序将神奇地构建在我的SQL Azure数据库中?
  2. What am I missing to make my app run? 我错过了什么让我的应用程序运行?

Detail: I didn't add any new item in Models folder. 细节:我没有在Models文件夹中添加任何新项目。 It's only AccountModels class, as it generates from MVC3 template. 它只是AccountModels类,因为它是从MVC3模板生成的。

Fortunatelly now I have the 2 answers: 幸运的是,现在我得到了2个答案:

  1. Yes, it's true and very easy! 是的,这是真的,非常容易!
  2. The mistake I did first time it was try to put MultipleActiveResultsSet as a new attribute in the connectionString line. 我第一次犯的错误是尝试将MultipleActiveResultsSet作为connectionString行中的新属性。 The code have to be like this: 代码必须是这样的:

     <add name="Project" connectionString="Server=tcp:xxxxxxxx.database.windows.net,xxxx;Database=xxxxx;User ID=xxxxxxxxxxx;Password=xxxxxxxxxxx;Trusted_Connection=False;Encrypt=True;**MultipleActiveResultSets=True**" providerName="System.Data.SqlClient" /> 

Edited 编辑

Now I found out other way to do that with AppFabric Caching for Session State. 现在,我发现了使用AppFabric缓存进行会话状态的其他方法。 Just follow this tutorial . 只需按照本教程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C#MVC3-新成员资格提供程序(System.Web.Providers)和旧成员资格类(System.Web.Security) - C# MVC3 - New Membership Providers (System.Web.Providers) and old Membership classes (System.Web.Security) 什么是Shibboleth服务提供商,可以并且应该为Windows Azure MVC3 Web角色安装它吗? - What is Shibboleth Service Provider, can & should I install it for a Windows Azure MVC3 web role? .NET成员资格,角色和授权在MVC3中 - .NET membership, role and authorize in MVC3 如何在mvc3 Web应用程序中设置特定路由 - How to set up specific routing in mvc3 web application 如何使用混合成员身份在mvc3 Web应用程序中使用[授权]和[FacebookAuthorize] - How to use [Authorize] and [FacebookAuthorize] in mvc3 web app using mixed membership 如何使用MVC3剃须刀打开新网页 - How to open a new web page using mvc3 razor 如何将MVC3 WebApp部署到Windows Azure - how to deploy MVC3 WebApp to windows Azure MVC3 / MVC4中的简单成员资格和角色提供程序 - Simple Membership and Role Provider in MVC3/MVC4 使用Windows Azure和ASP.NET MVC的成员资格 - Using Windows Azure and ASP.NET MVC with Membership 在Azure Web角色中托管的ASP.NET MVC3应用程序中是否需要SessionStateModule? - Do I need SessionStateModule in my ASP.NET MVC3 application hosted in Azure web role?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM