Request for the permission of type 'System.Data.SqlClient.SqlClientPermission [.....]' failed

G

goc

I have a Web Farm, that fetches its database-data from a separate
database-server. Today I was forced to go over to .NET 2.0 (since 1.1
can't be installed on Windows Vista x64), and it brought about quite
alot of problems. But now I've sorted out everything except one
problem that I just can't get to disappear:

As soon as I try to connect to a database from my code and run a
query, I get an exception thrown:

Check: Request for the permission of type
'System.Data.SqlClient.SqlClientPermission, System.Data,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand,
StackCrawlMark& 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
outerConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at SkaneData.Data.dbLayer.ExecuteDataSet(String SqlStmt, String
tableName)
at BookStore.Data.MenuDbLayer.getMenuParents() in \
\192.168.153.130\djurfakta\App_Code\Classes\dbLayer.cs:line 32
at BookStore.Classes.Menu.generateMenu(HttpContext Context, Int32
SelectedParent) in \\192.168.153.130\djurfakta\App_Code\Classes
\Menu.cs:line 25
at BookStore.Index.generateMenu() in \\192.168.153.130\djurfakta
\index.aspx.cs:line 109
at BookStore.Index.Page_Load(Object sender, EventArgs e) in \
\192.168.153.130\djurfakta\index.aspx.cs:line 37
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp,
Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object
sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.index_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS
\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root
\e7a2b103\219017a5\App_Web_x0ivfawf.24.cs:line 0
at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously)

I really have no idea of how to fix this. Since the code is compiled
at runtime in .NET 2.0, there's no DLL to increase the rights of (not
even sure it would have worked if I had a dll), and I've tried just
about every modification to web.config that I can think of (like cut-n-
pasting everything from web_hightrust.config into my own web.config,
and have followed every tip that I've been able to find on the net
(that all were regarding real applications, and therefore had little
help to provide)). But no matter what I do, the problem it just
doesn't go away...

The connectionstring and such are of course correct (havn't changed
them since the .NET 1.1-version that worked perfectly). One strange
thing, is that ASP.NET can connect to the state-databases and use it,
but it can't connect to my own databases.

Pleas help!
 
G

goc

It seems that this problem is somehow related to the fact that the
source files aren't located on the webserver, but are instead read
from a network share on a different server. So if I copy the site to
the local disc of one of the web servers, it works like it should on
that server. Hope this helps you help me, cause I'm really at a loss
here...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top