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(Obj ect demand,
StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.PermissionSet.Demand()
at System.Data.Common.DbConnectionOptions.DemandPermi ssion()
at System.Data.SqlClient.SqlConnection.PermissionDema nd()
at
System.Data.SqlClient.SqlConnectionFactory.Permiss ionDemand(DbConnection
outerConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(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\dbLaye r.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.Cal lback(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(Http Context 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.CallHandlerExecutionSte p.System.Web.HttpApplication.IExecutionStep.Execut e()
at System.Web.HttpApplication.ExecuteStep(IExecutionS tep 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!