[英]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: 所以,我有两个问题:
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个答案:
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.