Click here to Skip to main content
16,016,535 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: textbox validation Pin
User 27100923-Feb-08 9:12
User 27100923-Feb-08 9:12 
GeneralRe: textbox validation Pin
angels77723-Feb-08 13:26
angels77723-Feb-08 13:26 
GeneralRe: textbox validation Pin
User 27100923-Feb-08 15:29
User 27100923-Feb-08 15:29 
General3D text Pin
Yoyosch21-Feb-08 22:13
Yoyosch21-Feb-08 22:13 
GeneralRe: 3D text Pin
User 27100922-Feb-08 2:00
User 27100922-Feb-08 2:00 
GeneralRe: 3D text Pin
Yoyosch24-Feb-08 21:37
Yoyosch24-Feb-08 21:37 
GeneralRe: 3D text Pin
User 27100925-Feb-08 0:40
User 27100925-Feb-08 0:40 
QuestionSecurity exception when increasing maxReceivedMessageSize for XBAP [modified] Pin
Hashen20-Feb-08 21:25
Hashen20-Feb-08 21:25 
Hi, I've spent a good couple of days trying without luck to solve this problem I've run into to with my WPF browser application. Basically this is what I have :

A WCF service with a method that returns a large array which is called from my WPF browser application (XBAP). The XBAP is partial trust with the security zone set as "Internet". I'm using VS2008 team system.

I need to increase the maxReceivedMessageSize so that the array can be passed to the XBAP. I'm using basicHttpBinding so I need to increase the maxBufferSize by the same amount as well. My app.config file for the XBAP looks like the following:

<configuration>
<system.servicemodel>
<bindings>
<basichttpbinding>
<binding name="BasicHttpBinding_IService1" closetimeout="00:01:00">
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="1000000" maxBufferPoolSize="524288" maxReceivedMessageSize="1000000"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true"&gt;
<readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384">
maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
<security mode="None" />
</readerquotas></binding>
</basichttpbinding>
</bindings>
<client>
<endpoint address="http://{machine_name}/WcfWinService/Service1.svc">
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1" /&gt;
</endpoint></client>
</system.servicemodel>
</configuration>


But when I change the maxReceivedMessageSize and maxBufferSize by any amount I get a "System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed." exception.

The stack trace I get back is :


Startup URI: http://{machine_name}/WpfBrowserApp/WpfBrowserApplication.xbap
Application Identity: http://{machine_name}/WpfBrowserApp/WpfBrowserApplication.xbap#WpfBrowserApplication.xbap, Version=1.0.0.33, Culture=neutral, PublicKeyToken=d11ee682d0580e4f, processorArchitecture=msil/WpfBrowserApplication.exe, Version=1.0.0.33, Culture=neutral, PublicKeyToken=d11ee682d0580e4f, processorArchitecture=msil, type=win32

System.Windows.Markup.XamlParseException: Cannot create instance of 'Page1' defined in assembly 'WpfBrowserApplication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation. Error in markup file 'Page1.xaml' Line 1 Position 7. ---&gt; System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&gt;<b> System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.</b>
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
<b> at System.Net.HttpWebRequest.set_DefaultMaximumErrorResponseLength(Int32 value)</b>
at System.ServiceModel.Channels.HttpChannelFactory.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelFactory.TypedServiceChannelFactory`1.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ChannelFactory.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open()
at System.ServiceModel.ChannelFactory.EnsureOpened()
at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)
at System.ServiceModel.ClientBase`1.CreateChannel()
at System.ServiceModel.ClientBase`1.CreateChannelInternal()
at System.ServiceModel.ClientBase`1.get_Channel()
at WpfBrowserApplication.ServiceReference1.Service1Client.GetData(UserObj[] users)
at WpfBrowserApplication.Page1..ctor()
The action that failed was:
Demand
The type of the first permission that failed was:
System.Net.WebPermission


I also created a normal ASP.net web application and tried increasing the maxReceivedMessageSize and maxBufferSize and calling the wcf service from there to test it with no problems at all.

Please help Cry | :((

modified on Thursday, February 21, 2008 3:45 AM
GeneralRe: Security exception when increasing maxReceivedMessageSize for XBAP Pin
User 27100921-Feb-08 15:32
User 27100921-Feb-08 15:32 
GeneralRe: Security exception when increasing maxReceivedMessageSize for XBAP Pin
Hashen21-Feb-08 20:10
Hashen21-Feb-08 20:10 
GeneralRe: Security exception when increasing maxReceivedMessageSize for XBAP Pin
User 27100922-Feb-08 1:57
User 27100922-Feb-08 1:57 
GeneralRe: Security exception when increasing maxReceivedMessageSize for XBAP Pin
Hashen24-Feb-08 22:13
Hashen24-Feb-08 22:13 
GeneralRe: Security exception when increasing maxReceivedMessageSize for XBAP Pin
User 27100925-Feb-08 0:32
User 27100925-Feb-08 0:32 
GeneralRe: Security exception when increasing maxReceivedMessageSize for XBAP Pin
Hashen25-Feb-08 1:53
Hashen25-Feb-08 1:53 
GeneralRe: Security exception when increasing maxReceivedMessageSize for XBAP Pin
User 27100925-Feb-08 13:19
User 27100925-Feb-08 13:19 
GeneralRe: Security exception when increasing maxReceivedMessageSize for XBAP Pin
Stephen4226-Mar-08 23:19
Stephen4226-Mar-08 23:19 
QuestionEfficient Real-Time X-Y Plotting/Graphing Pin
jlgeris20-Feb-08 10:34
jlgeris20-Feb-08 10:34 
GeneralRe: Efficient Real-Time X-Y Plotting/Graphing Pin
Christoph Menge24-Feb-08 9:56
Christoph Menge24-Feb-08 9:56 
GeneralRe: Efficient Real-Time X-Y Plotting/Graphing Pin
jlgeris25-Feb-08 4:24
jlgeris25-Feb-08 4:24 
GeneralWPF Anchor Pin
Yoyosch20-Feb-08 5:19
Yoyosch20-Feb-08 5:19 
GeneralRe: WPF Anchor Pin
jesarg20-Feb-08 7:07
jesarg20-Feb-08 7:07 
GeneralRe: WPF Anchor Pin
Yoyosch21-Feb-08 4:43
Yoyosch21-Feb-08 4:43 
QuestionWPF data binding - How to cancel an edit Pin
Simon P Stevens18-Feb-08 22:47
Simon P Stevens18-Feb-08 22:47 
GeneralRe: WPF data binding - How to cancel an edit Pin
User 27100918-Feb-08 23:16
User 27100918-Feb-08 23:16 
GeneralRe: WPF data binding - How to cancel an edit Pin
Simon P Stevens19-Feb-08 1:54
Simon P Stevens19-Feb-08 1:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.