Search code examples
asp.netasp.net-mvcasp.net-membershipsql-server-2008-express.net-4.0

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


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.


Solution

  • 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..