I'm trying to run my application in localhost. But I always get "EntityException-The underlying provider failed on Open" - All the static pages are working.
Same application if I use VS2017 to run application is working fine. (Able to retrieve data from DB)
Is it anything to do with the Connection String?
Here's my connection string:
<add name="NaturesKingdomUKEntities" connectionString="metadata=res://*/Models.DB.NaturesKingdomUK_DB.csdl|res://*/Models.DB.NaturesKingdomUK_DB.ssdl|res://*/Models.DB.NaturesKingdomUK_DB.msl;provider=System.Data.SqlClient;provider connection string="
data source=xxx-xxx;initial catalog=xxxx;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
Sample method that I use to get data from db:
public List<ProductDetails> GetFineFragrancesProductDetails(string ProductCodeID)
{
try
{
using (xxxxEntities db = new xxxxUKEntities())
{
//db.Connection.Open();
if (ProductCodeID == "All")
{
var queryList = db.ProductInfoes.ToList();
UpdateProductDetailsList(queryList);
}
else
{
var queryList = db.ProductInfoes.Where(x => x.Product_Code_ID.Equals(ProductCodeID)).ToList();
UpdateProductDetailsList(queryList);
}
return lst;
}
}
catch (Exception err)
{
SendErrorToText(err, "DB - GetFineFragrancesProductDetails");
return null;
}
}
Exception Details:
Error Message: EntityException
Exception Type: System.Data.EntityException
Error Url: http://xxxx.local/xxxx/FineFragrxances
User Host IP: 127.0.0.1
Error Location : The underlying provider failed on Open.