Reputation: 7931
I have write a method for inserting some data to the db using Entity framework like below which is called as a wcf service
bool status=false;
MyDataContext dc = new MyDataContext();
var getData = dc.Register.FirstOrDefault(x => x.DeviceId == deviceId.Trim());
if (getData != null)
{
status = true;
}
return status;
In local it insert successfully. But after publishing i try to insert again.At that time i got exception The provider did not return a ProviderManifestToken string How can i resolve this error?
Connectionstring
<connectionStrings>
<add name="DataContext" connectionString="Data Source=MYNAME\SQL2008R2; Initial Catalog=MyDb; Integrated Security=True; MultipleActiveResultSets=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
Upvotes: 1
Views: 4171
Reputation: 65431
Your connection string uses Integrated Security = true.
This means that the connection to the database is made using the security context of the calling process.
When you run locally you are in the security context of your user. Therefore, it works.
When you deploy to IIS, the default is that you are in the security context of the application pool, which is NETWORK SERVICE. Since NETWORK SERVICE does not have access to the database you get an error.
Upvotes: 3