I have an ASP.NET MVC application with the default membership database. I am accessing it by ADO.NET Entity Framework.
Now I want to move it to IIS, but several problems showed up. I had to install SQL Server Management Studio, Create new DB, import there all the data from the previous .MDF file. Only thing left to do (as far a I know) is to change to connection string. However, I am not really experienced with this and keep getting the exception:
Keyword not supported: ‘data source’.
Here is my connection string:
<add name="ASPNETDBEntities"
connectionString="Data Source=MONTGOMERY-DEV\SQLEXPRESS;Initial Catalog=ASPNETDB;Integrated Security=True;"
providerName="System.Data.EntityClient" />
Any ideas, what’s wrong?
What you have is a valid ADO.NET connection string – but it’s NOT a valid Entity Framework connection string.
The EF connection string would look something like this:
You’re missing all the
metadata=andproviderName=elements in your EF connection string…… you basically only have what’s contained in theprovider connection stringpart.Using the EDMX designer should create a valid EF connection string for you, in your web.config or app.config.
I understand what you’re trying to do: you need a second "ADO.NET" connection string just for ASP.NET user / membership database. Your string is OK, but the providerName is wrong – it would have to be "System.Data.SqlClient" – this connection doesn’t use ENtity Framework – don’t specify the "EntityClient" for it then!
If you specify
providerName=System.Data.EntityClient==> Entity Framework connection string (with the metadata= and everything).If you need and specify
providerName=System.Data.SqlClient==> straight ADO.NET SQL Server connection string without all the EF additions