By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,569 Members | 1,338 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,569 IT Pros & Developers. It's quick & easy.

Calling Web Services from a Web Form throws CAS violation

P: n/a
We created a C# Windows forms application and put the .EXE on our web server.

We can download the executable from the web server to a desktop and it will
display OK. When we click a button that causes the executable to call a web
service on the same web server, we get the following code access security
violation.

-------------- begin violation -------------------------------------------
Could not talk to the web server. Error = 'System.InvalidOperationException:
There is an error in XML document (1, 269). --->
System.Security.SecurityException: Security error.

at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read2_ReturnDS(Boolean isNullable, Boolean checkType)

at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read9_StorlibReadResponse()

The granted set of the failing assembly was:
<PermissionSet class="System.Security.PermissionSet"
version="1">

<IPermission class="System.Security.Permissions.FileDialogPermi ssion,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"/>

<IPermission
class="System.Security.Permissions.IsolatedStorage FilePermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Allowed="None"/>

<IPermission class="System.Security.Permissions.SecurityPermiss ion,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
Flags="Execution"/>

<IPermission class="System.Security.Permissions.UIPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Window="SafeTopLevelWindows"/>

<IPermission class="System.Net.DnsPermission, System, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"/>

<IPermission class="System.Drawing.Printing.PrintingPermission,
System.Drawing, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
version="1"
Level="NoPrinting"/>

<IPermission class="System.Diagnostics.PerformanceCounterPermis sion,
System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"/>

<IPermission class="System.Security.Permissions.UrlIdentityPerm ission,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
Url="file://C:/winnt/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll"/>

<IPermission class="System.Security.Permissions.ZoneIdentityPer mission,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
Zone="MyComputer"/>

</PermissionSet>

--- End of inner exception stack trace ---

at System.Xml.Serialization.XmlSerializer.Deserialize (XmlReader
xmlReader, String encodingStyle)
at System.Xml.Serialization.XmlSerializer.Deserialize (XmlReader xmlReader)
at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
methodName, Object[] parameters)
at BackIssue.com.kcc.cad.Service.StorlibRead(String wildcard)
at BackIssue.FormMain.searchForWildcard()'

---------------- end violation -------------------------------------------

What do I need to do to get past this violation?

Joe
Nov 23 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.