tags:

views:

152

answers:

1

Hello everyone,

I have a problem, that is really driving me crazy.

First of all I must admit, that most of the work was done by a coworker, who isn't available anymore.

Before reinstalling the MSSQL Server rig, the whole thing looked like that:

  • Someone has developed a little .Net c# program which connects to the SQL Server, that is located on a different network share. Everything worked

We had to reinstall the server (Windows + SQL Server) and since that moment, if the program is run from that network share, I get the following error:

"Unhandled Exception: System.Security.SecurityException: Request for the permissi on of type 'System.Data.SqlClient.SqlClientPermission, System.Data, ......"

If I run the programm locally from the computer where the shares are located, it works - so I guess all security issues where set right at the SQL Server. But there has to be a problem, because it worked correct before the reinstall.

Does this make any sense to someone? Or any ideas how to fix that?

Edit: Posted error message below. The program is called by a batch script.

C:\Projekte\Tool>\\server\c$\Projekte\Tool\ToolRea
der.exe

Unhandled Exception: System.Security.SecurityException: Request for the permissi
on of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.
0.0, Culture=neutral, PublicKeyToken=a76a5c5b1932e089' failed.
   at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMa
rk& stackMark, Boolean isPermSet)
   at System.Security.PermissionSet.Demand()
   at System.Data.Common.DbConnectionOptions.DemandPermission()
   at System.Data.SqlClient.SqlConnection.PermissionDemand()
   at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection o
uterConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection ou
terConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionU
ser user)
   at System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe()
   at System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode()
   at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider
.Execute(Expression query)
   at System.Data.Linq.DataQuery`1.System.Collections.Generic.IEnumerable<T>.Get
Enumerator()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at System.Data.Linq.Table`1.DeleteAllOnSubmit[TSubEntity](IEnumerable`1 entit
ies)
   at ToolReader.DataAccessLayer.ToolInfoDAO.deleteAllEntries(
)
   at ToolReader.ToolReader.Main(String[] args)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Data.SqlClient.SqlClientPermission
The first permission that failed was:
<IPermission class="System.Data.SqlClient.SqlClientPermission, System.Data, Vers
ion=2.0.0.0, Culture=neutral, PublicKeyToken=a76a5c5b1932e089"
version="1"
AllowBlankPassword="False">
<add ConnectionString="Data Source=sqlserver\SQLEXPRESS;Initial Catalog=ToolDB;Integrated Security=True"
KeyRestrictions=""
KeyRestrictionBehavior="AllowOnly"/>
</IPermission>

The demand was for:
<PermissionSet class="System.Security.PermissionSet"
version="1">
<IPermission class="System.Data.SqlClient.SqlClientPermission, System.Data, Vers
ion=2.0.0.0, Culture=neutral, PublicKeyToken=a76a5c5b1932e089"
version="1"
AllowBlankPassword="False">
<add ConnectionString="Data Source=sqlserver\SQLEXPRESS;Initial Catalog=ToolDB;Integrated Security=True"
KeyRestrictions=""
KeyRestrictionBehavior="AllowOnly"/>
</IPermission>
</PermissionSet>

The granted set of the failing assembly was:
<PermissionSet class="System.Security.PermissionSet"
version="1">
<IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib,
 Version=2.0.0.0, Culture=neutral, PublicKeyToken=a76a5c5b1932e089"
version="1"
Read="USERNAME"/>
<IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=a76a5c5b1932e089"
version="1"
Unrestricted="true"/>
<IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Vers
ion=2.0.0.0, Culture=neutral, PublicKeyToken=a76a5c5b1932e089"
version="1"
Read="\\server\C$\Projekte\Tool\"
PathDiscovery="\\server\C$\Projekte\Tool\"/>
<IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, m
scorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=a76a5c5b1932e089"
version="1"
Allowed="AssemblyIsolationByUser"
UserQuota="9223372036854775807"
Expiry="9223372036854775807"
Permanent="True"/>
<IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=a76a5c5b1932e089"
version="1"
Flags="ReflectionEmit"/>
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Ve
rsion=2.0.0.0, Culture=neutral, PublicKeyToken=a76a5c5b1932e089"
version="1"
Flags="Assertion, Execution, BindingRedirects"/>
<IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=
2.0.0.0, Culture=neutral, PublicKeyToken=a76a5c5b1932e089"
version="1"
Unrestricted="true"/>
<IPermission class="System.Security.Permissions.UrlIdentityPermission, mscorlib,
 Version=2.0.0.0, Culture=neutral, PublicKeyToken=a76a5c5b1932e089"
version="1"
Url="file://server/c$/Projekte/Tool/ToolReader.exe"/>
<IPermission class="System.Security.Permissions.ZoneIdentityPermission, mscorlib
, Version=2.0.0.0, Culture=neutral, PublicKeyToken=a76a5c5b1932e089"
version="1"
Zone="Intranet"/>
<IPermission class="System.Net.DnsPermission, System, Version=2.0.0.0, Culture=n
eutral, PublicKeyToken=a76a5c5b1932e089"
version="1"
Unrestricted="true"/>
<IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
version="1"
Level="DefaultPrinting"/>
</PermissionSet>

The assembly or AppDomain that failed was:
ToolReader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
The method that caused the failure was:
Void deleteAllEntries()
The Zone of the assembly that failed was:
Intranet
The Url of the assembly that failed was:
file://server/c$/Projekte/Tool/ToolReader.exe
A: 

Hi,

this is a .NET-Security-Issue. It treats Apps from a Network-Share different than from a local folder.

Right now I am not sure how we fixed this in the past, but try the following: On the calling computer (not the server) set up a manual trust to this program (=Assembly) with the .Net-wizard from the control panel, using \server\share\program for navigation.

I think you can get it working with changing the Security-Levels/Zones as well.

DKrause
Thank you for your answer. I had foudn that, too.I have already changed all .Net Zones to FullTrusted, but it didn't affect the problem.And to remind everyone: it has worked before, we have never touched the program, only the SQL Server...
powerbar