I have an ASP.NET application, using LINQ to connec to a SQL Server 2008 R2 databse.
My connection string:
Data Source=[SqlServerIp];Initial Catalog=[dat
I would get this error when trying to run a Web Service in debug mode. I found that it was because code was on a network drive (in my case my documents was on the home drive).
I would suggest checking that the code in not a network drive.
The security context under which your ASP.net application is running does not have permissions to load that sql client assembly. The out of the box context, ASPNET, does, so there's problem been some custom configuration that has broken it...it's difficult to say what without being able to look at the box.
But the bottom line is that the security context of the application doesn't have perms to that assembly. The following steps should get you working:
Response.Write(System.Security.Principal.Current().WindowsIdentity.Name);
Add the user named on that page to the administrators group. This should allow the assembly to load.
Reduce the permissions of the specified user to a minimum downward from administrator.
I had faced the same problem, and I resolved this way:
Changing the app pool identity that my application uses in IIS to pre-built account NetworkService.
The default identity is ApplicationPoolIdentity, and looks like it doesn't have enough privileges to access network resources.