Jorg Ancrath Jorg Ancrath - 2 months ago 22
ASP.NET (C#) Question

Identity Connection string, from local to host

So I have the following in my local web.config file:

<connectionStrings>
<add name="orangefreshConnectionString1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\orangefresh.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
<add name="orangefreshEntities" connectionString="metadata=res://*/App_Code.Orangefresh.csdl|res://*/App_Code.Orangefresh.ssdl|res://*/App_Code.Orangefresh.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\orangefresh.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>


I uploaded my website to my host, created my database and attached the necessary files to it (the mdf file and the log file), running a query shows the database has all the right data and is working fine.

The host has given me the following connection string:

workstation id=orangefresh.mssql.somee.com;packet size=4096;user id=xxxx;pwd=xxxx;data source=orangefresh.mssql.somee.com;persist security info=False;initial catalog=orangefresh


(I blacked out the user/pass details)
This connection string, I'm guessing is the to replace the local "orangefreshConnectionString1" connection string, which I've done. Now I'm left wondering what to replace my Identity connection string with, the "orangefreshEntities" which makes use the Entity Framework.

This obviously results in error on the pages that make use of ADO, all the other pages work fine it seems. Any ideas on what to do with the Entity connection string?

Answer

Fixed:

<add name="orangefreshEntities" connectionString="metadata=res://*/App_Code.Orangefresh.csdl|res://*/App_Code.Orangefresh.ssdl|res://*/App_Code.Orangefresh.msl;provider=System.Data.SqlClient;provider connection string=&quot;workstation id=orangefresh.mssql.somee.com;packet size=4096;user id=xxxx;pwd=xxxx;data source=orangefresh.mssql.somee.com;persist security info=False;initial catalog=orangefresh&quot;" providerName="System.Data.EntityClient" />

the trick was putting the connection string in between the $quot marks.