While using the Entity Framework I have split it out to it's own project:
Everything in the web site is working fine. I am able to call into the Controller and get a valid Model back. When I try the same thing from the Web.Service I am getting this error:
ERROR:
The underlying provider failed on ConnectionString.
STACK TRACE:
at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
at System.Data.EntityClient.EntityConnection..ctor(String connectionString)
at System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString)
at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)
at RivWorks.Model.Entities.RivFeedsEntities1..ctor(String connectionString)
at RivWorks.Model.FeedStoreReadOnly..ctor(String connectionString)
at RivWorks.Controller.ProductManager.LookupProduct(String productID, String sku, String urlRef, String env, String logPath)
I am a bit confused as to why and digging through the error logs I finally figured out the connection strings were not being read from the Web Site's config file. So, I added some code to catch that and, for now, hard coded the values in. Like:
public dataObjects.NegotiateSetup LookupProduct(string productID, string sku, string urlRef, string env, string logPath)
{
string feedConnString = "";
string rivConnString = "";
log.InitializeLogFile(logPath);
dataObjects.NegotiateSetup resultSet = new dataObjects.NegotiateSetup();
try { feedConnString = AppSettings.FeedAutosEntities_connString; }
catch { feedConnString = @"metadata=res://*/Entities.FeedEntities.csdl|res://*/Entities.FeedEntities.ssdl|res://*/Entities.FeedEntities.msl;provider=System.Data.SqlClient;provider connection string='Data Source=***.***.***.***;Initial Catalog=******;Persist Security Info=True;User ID=******;Password="******";MultipleActiveResultSets=True'"; }
try { rivConnString = AppSettings.RivWorkEntities_connString; }
catch { rivConnString = @"metadata=res://*/Entities.RivEntities.csdl|res://*/Entities.RivEntities.ssdl|res://*/Entities.RivEntities.msl;provider=System.Data.SqlClient;provider connection string='Data Source=******;Initial Catalog=******_Dev;Persist Security Info=True;User ID=******;Password="******";MultipleActiveResultSets=True'"; }
try
{
using (RivFeedsEntities1 _dbFeed = new FeedStoreReadOnly(feedConnString).ReadOnlyEntities())
{
using (RivEntities _dbRiv = new RivWorksStore(rivConnString).NegotiationEntities())
{
But, alas, it is still giving me the above error! Any ideas why?
I know you've been mucking around with your connection strings to sanitize them but I'm guessing you didn't put the "
's around the password in?
Are they actually required?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With