ASP.NET MVC:使用相同的数据库实体框架和ASP.NET成员资格 [英] ASP.NET MVC : Using the same database for Entity Framework and ASP.NET Membership

查看:252
本文介绍了ASP.NET MVC:使用相同的数据库实体框架和ASP.NET成员资格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着去用户ASP.NET MVC3与实体框架和ASP.NET成员资格进行验证。我已经成立了一个现有的数据库,作为会员我的应用程序服务数据库。

当我通过向导创建实体数据模型,它添加了以下连接字符串我的web.config。

 <添加名称=DBEntities connectionString="metadata=res://*/Models.DB.csdl|res://*/Models.DB.ssdl|res://*/Models.DB.msl;provider=System.Data.SqlClient;provider连接字符串=安培; QUOT;数据源= PM \ SQLEX $ P $干燥综合征;初始目录= DB;集成安全性= TRUE; MultipleActiveResultSets =真放; QUOT;的providerName =System.Data.EntityClient/>
 

我是小白,所以我真的不明白为什么,但我尝试使用相同的连接字符串我的会员提供者和失败(因为这样可能:的ProviderName =System.Data.EntityClient?)

所以我增加了一个单独的连接字符串到同一个数据库,并用它为成员提供。

 <添加名称=ApplicationServices的connectionString =数据源= PM \ SQLEX $ P $干燥综合征;初始目录= DB;集成安全性=真的providerName =System.Data这.SqlClient/>
 

它工作正常,当我使用ASP.NET配置添加用户等。但是,当我运行的应用程序,并尝试做一些像验证用户我得到一个错误;

  

已经从服务器接收结果时发生传输级错误。 (提供程序:共享内存提供程序,error:0 - 句柄无效)

我做了一个猜测这有什么与我的连接字符串。我希望你的一些专家,可以提供帮助。干杯。

解决方案

您是否尝试过重新启动服务器:<一href="http://stackoverflow.com/questions/2962927/a-transport-level-error-has-occurred-when-receiving-results-from-the-server">http://stackoverflow.com/questions/2962927/a-transport-level-error-has-occurred-when-receiving-results-from-the-server ?

不是一个解决办法或答案,只是一个指向类似的问题。

Im trying to user ASP.NET MVC3 with Entity Framework and ASP.NET Membership for authentication. I've set up an existing database as my application services database for membership.

When i create the entity data model through the wizard it adds the following connection string to my web.config.

<add name="DBEntities" connectionString="metadata=res://*/Models.DB.csdl|res://*/Models.DB.ssdl|res://*/Models.DB.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=PM\SQLEXPRESS;Initial Catalog=DB;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />

I'm a noob so i don't really understand why but i tried using the same connection string for my membership provider and failed (probably because of this: providerName="System.Data.EntityClient" ?).

So i added a separate connection string to the same database and used it for the membership provider.

<add name="ApplicationServices" connectionString="Data Source=PM\SQLEXPRESS;Initial Catalog=DB;Integrated Security=True"  providerName="System.Data.SqlClient"/>

It works fine when i use ASP.NET configuration to add user and etc. But when i run the application and try to do something like validating a user i get an error;

A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 0 - The handle is invalid.)

I made a guess this has something to do with my connection strings. I'm hoping some of you experts can help. Cheers.

解决方案

Have you tried restarting the server : http://stackoverflow.com/questions/2962927/a-transport-level-error-has-occurred-when-receiving-results-from-the-server ?

Not a solution or an answer, just a pointer to a similar issue..

这篇关于ASP.NET MVC:使用相同的数据库实体框架和ASP.NET成员资格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆