B
Benjamin Bloom
Hi,
I'm pretty new to .NET, and even more new to Web Services. I've written
a few stand-alone apps that successfully interact with a database,
though, and I'm now puzzled.
I have a web service running on my machine (for now) and a Windows app
that calls a WebMethod from that service. Whenever I call a method that
interacts with a database, I get the following error:
An unhandled exception of type
'System.Web.Services.Protocols.SoapException' occurred in
system.web.services.dll
Additional information: System.Web.Services.Protocols.SoapException:
Server was unable to process request. --->
System.Security.SecurityException: Request for the permission of type
System.Data.SqlClient.SqlClientPermission, System.Data,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
at
System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
PermissionToken permToken)
at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32
checkFrames, Int32 unrestrictedOverride)
at
System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap,
StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Demand()
at
System.Data.SqlClient.SqlConnectionString.Demand(SqlConnectionString constr)
at System.Data.SqlClient.SqlConnection.Open()
at Macgregor.DataExtractService.DataExtractor.testDB()
The state of the failed permission was:
<IPermission class="System.Data.SqlClient.SqlClientPermission,
System.Data, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
AllowBlankPassword="False">
<add ConnectionString="user id=sa;initial catalog=northwind;data
source=Central;Connect Timeout=30;Trusted_Connection=Yes"
KeyRestrictions=""
KeyRestrictionBehavior="AllowOnly"/>
</IPermission>
--- End of inner exception stack trace ---
Yet if I copy the method to the stand alone Windows app, I can execute
it just fine. I assume this is a configuration error, and not a code
error. What am I missing?
Thanks.
-Ben
I'm pretty new to .NET, and even more new to Web Services. I've written
a few stand-alone apps that successfully interact with a database,
though, and I'm now puzzled.
I have a web service running on my machine (for now) and a Windows app
that calls a WebMethod from that service. Whenever I call a method that
interacts with a database, I get the following error:
An unhandled exception of type
'System.Web.Services.Protocols.SoapException' occurred in
system.web.services.dll
Additional information: System.Web.Services.Protocols.SoapException:
Server was unable to process request. --->
System.Security.SecurityException: Request for the permission of type
System.Data.SqlClient.SqlClientPermission, System.Data,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
at
System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
PermissionToken permToken)
at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32
checkFrames, Int32 unrestrictedOverride)
at
System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap,
StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Demand()
at
System.Data.SqlClient.SqlConnectionString.Demand(SqlConnectionString constr)
at System.Data.SqlClient.SqlConnection.Open()
at Macgregor.DataExtractService.DataExtractor.testDB()
The state of the failed permission was:
<IPermission class="System.Data.SqlClient.SqlClientPermission,
System.Data, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
AllowBlankPassword="False">
<add ConnectionString="user id=sa;initial catalog=northwind;data
source=Central;Connect Timeout=30;Trusted_Connection=Yes"
KeyRestrictions=""
KeyRestrictionBehavior="AllowOnly"/>
</IPermission>
--- End of inner exception stack trace ---
Yet if I copy the method to the stand alone Windows app, I can execute
it just fine. I assume this is a configuration error, and not a code
error. What am I missing?
Thanks.
-Ben