ASP.NET MVC : Using the same database for Entity Framework and ASP.NET Membership

浪尽此生 提交于 2019-12-23 04:05:08

问题


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.


回答1:


Have you tried restarting the server : 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..



来源:https://stackoverflow.com/questions/4782658/asp-net-mvc-using-the-same-database-for-entity-framework-and-asp-net-membershi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!