SQLClientPermission problem



This is driving me dotty . . .

I have written some C# code that accesses a SQL Server database. I
have 2 machines. The database is on Machine 1. If I run my code on
Machine 1 it works fine. If I run my code on Machine 2, I get a
SqlClientPerrmission exception when opening the database connection.
The same connection string is used in each case specifying the machine
name on which the database is running explicitly (not using
localserver or (local)) - it also explicitly contains the UserID,
Password and Database. In each case, the code is physically stored in
the same place on Machine 1 which is accessed thorugh a network
share / mapped drive. The solution builds with no errors / no
warnings.

Configuration is both machines running Visual Studio Express 2005 with
SP1 applied (and Vista patch on machine 2). Both machines also
have .NET Framework 2.0 and the 2.0 SDK installed. Machine 1 is
running WinXPPro on 32-bit AMD processor. Machine 2 is running Vista
Home Premium x64 on 64-bit AMD processor. Both have 1GB RAM and ample
disc space. Machines are using wired LAN, not wireless, and
connectivity is fine for all other purposes. Network is peer to peer,
not a domain. Both machines use Norton Internet Security for anti-
virus / firewall and I am not aware of any problems with it and the
log files do not show any relevant traffic being blocked at either
end.

Both machines have SQL Server 2005 Express installed. Machine 1 has
TCP connectivity enabled over my LAN (but not from my internet
connection). I am using SQL Server authentication. I can connect to
SQL Server on Machine 1 from Machine 2 using SQL Server Management
Studio Express.

All Microsoft updates available have been applied to both machines.

The .exe assembly (the only assembly in the project / solution)
containing my code is signed with my strong name and the .NET 2.0
machine security.config has a code group to give Full Trust to
assemblies on my local intranet signed with my strong name. Using the
Evaluate Assembly tool on machine 2 in the .NET 2.0 Configuration
management console confirms that my .exe has Full Trust and that it is
recognising the assembly as residing on my local intranet and that it
has the strong key name. From machine 1, it says that it is in the My
Computer zone.

In Internet Options / Security / Local Intranet / Sites I have
disabled automatic detection of the local intranet and manually
enabled the 3 options in that dialog box. Without this, the Evaluate
Assembly on machine 2 thinks the assembly is located on the Internet
not my Local Intranet.

I also have .NET 1.1 and Visual Studio 2003 installed on both machines
and similar security settings in the .NET 1.1 machine.config.

What am I missing? Why does Full Trust not seem to give me
SqlClientPermission on machine 2?

The only other anomaly on machine 2 is that running the .NET 2.0
Configuration console from Administrative Tools on machine 2 is not
reliable - I have 2 Administrator logins - with one it works fine -
with the other I get a security exception and the console terminates.
Could this be related? Or is it a red herring? The behaviour of my
C# code described above is the same with either administrator login.

Many thanks for any assistance.

.



Relevant Pages

  • Re: SQLClientPermission problem
    ... The database is on Machine 1. ... SqlClientPerrmission exception when opening the database connection. ... assemblies on my local intranet signed with my strong name. ...
    (microsoft.public.dotnet.security)
  • Re: MS Access DAO -> ADO.NET Migration
    ... William Vaughn ... Microsoft MVP ... Hitchhiker's Guide to Visual Studio and SQL Server ... My migration app works building a SSCE database file with imported data ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Cluster will not fail over.
    ... > As far as the TCP/IP issue goes, you had to rebuild the cluster and were ... > able to restore the master database. ... > a cluster installation you'll have to revisit. ... >> This worked bringing up the sql server in minimal mode. ...
    (microsoft.public.sqlserver.clustering)
  • Re: MS Access DAO -> ADO.NET Migration
    ... full SQL Server and I see the logic you explained in a multi user ... allow two users to access the same database file Read/Write at any given ... The book was a pleasure to read after the gibberish that Microsoft 'puts ... Hitchhiker's Guide to Visual Studio and SQL Server ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: MS Access DAO -> ADO.NET Migration
    ... For that it is much harder to handle the incremental identifier, ... database but although they have the data, they are not connected at the same ... The book was a pleasure to read after the gibberish that Microsoft 'puts ... SQL Server Management Studio is nowhere to be found on my ...
    (microsoft.public.dotnet.framework.adonet)

Loading