Exception : The provider did not return a ProviderManifestToken string-Entityframework

元气小坏坏 提交于 2019-12-08 07:02:53

问题


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>

回答1:


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.



来源:https://stackoverflow.com/questions/16279019/exception-the-provider-did-not-return-a-providermanifesttoken-string-entityfra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!