带有WCF错误的WPF XBAP(该程序集不允许部分受信任的调用方.)

编程入门 行业动态 更新时间:2024-10-26 12:32:52
本文介绍了带有WCF错误的WPF XBAP(该程序集不允许部分受信任的调用方.)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图在XBAP中使用WCF,但由于部分信任(使用完全信任)而出现错误.两个应用程序都托管在本地主机上 错误: 启动URI: wnyc2ua6520rzj.iam.intranet/XBAPWPFTry1/XBAPWPFTry1.xbap 应用程序身份: wnyc2ua6520rzj.iam.intranet/XBAPWPFTry1/XBAPWPFTry1.xbap /a>,版本= 1.0.0.1,文化=中性,PublicKeyToken = a3b509f224248913,processorArchitecture = msil/XBAPWPFTry1.exe,版本= 1.0.0.1,文化=中性,PublicKeyToken = a3b509f224248913,processorArchitecture = msil,type = win32

I am trying to use WCF in XBAP but getting below error with partial trust (working with full trust). Both Application hosted on localhost Error: Startup URI: wnyc2ua6520rzj.iam.intranet/XBAPWPFTry1/XBAPWPFTry1.xbapApplication Identity: wnyc2ua6520rzj.iam.intranet/XBAPWPFTry1/XBAPWPFTry1.xbap#XBAPWPFTry1.xbap, Version=1.0.0.1, Culture=neutral, PublicKeyToken=a3b509f224248913, processorArchitecture=msil/XBAPWPFTry1.exe, Version=1.0.0.1, Culture=neutral, PublicKeyToken=a3b509f224248913, processorArchitecture=msil, type=win32

System.Configuration.ConfigurationErrorsException:为system.serviceModel/bindings创建配置节处理程序时发生错误:该程序集不允许部分受信任的调用方. (C:\ Documents and Settings \ VGoyal \ Local Settings \ Apps \ 2.0 \ Q0WJXK1Q.T5M \ W5NR1ED4.RN9 \ xbap..xbap_a3b509f224248913_0001.0000_b4daec195415e959 \ XBAPWPFTry1.exe.config第4行)---> System.Security.SecurityException:该程序集不允许部分受信任的调用方.在System.Security.CodeAccessSecurityEngine.ThrowSecurityException(组件asm,已授予PermissionSet,拒绝PermissionSet,RuntimeMethodHandle rmh,SecurityAction操作,对象需求,IPermission permThatFailed)处.在System.Reflection.MethodBase.PerformSecurityCheck(对象obj,RuntimeMethodHandle方法,IntPtr父级,UInt32 invocationFlags)处在System.RuntimeType.CreateInstanceImpl(布尔publicOnly,布尔skipVisibilityChecks,布尔fillCache)处启动URI: wnyc2ua6520rzj.iam.in /XBAPWPFTry1/XBAPWPFTry1.xbap 应用程序标识: wnyc2ua6520rzj. .intranet/XBAPWPFTry1/XBAPWPFTry1.xbap#XBAPWPFTry1.xbap ,版本= 1.0.0.1,文化=中性,PublicKeyToken = a3b509f224248913,processorArchitecture = msil/XBAPWPFTry1.exe,版本= 1.0.0.1,文化=中性,公钥= a3b509f224248913,processorArchitecture = msil,类型= win32

System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for system.serviceModel/bindings: That assembly does not allow partially trusted callers. (C:\Documents and Settings\VGoyal\Local Settings\Apps\2.0\Q0WJXK1Q.T5M\W5NR1ED4.RN9\xbap..xbap_a3b509f224248913_0001.0000_b4daec195415e959\XBAPWPFTry1.exe.config line 4) ---> System.Security.SecurityException: That assembly does not allow partially trusted callers. at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) at System.Reflection.MethodBase.PerformSecurityCheck(Object obj, RuntimeMethodHandle method, IntPtr parent, UInt32 invocationFlags) at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)Startup URI: wnyc2ua6520rzj.iam.intranet/XBAPWPFTry1/XBAPWPFTry1.xbapApplication Identity: wnyc2ua6520rzj.iam.intranet/XBAPWPFTry1/XBAPWPFTry1.xbap#XBAPWPFTry1.xbap, Version=1.0.0.1, Culture=neutral, PublicKeyToken=a3b509f224248913, processorArchitecture=msil/XBAPWPFTry1.exe, Version=1.0.0.1, Culture=neutral, PublicKeyToken=a3b509f224248913, processorArchitecture=msil, type=win32

System.Configuration.ConfigurationErrorsException:为system.serviceModel/bindings创建配置节处理程序时发生错误:该程序集不允许部分受信任的调用方. (C:\ Documents and Settings \ VGoyal \ Local Settings \ Apps \ 2.0 \ Q0WJXK1Q.T5M \ W5NR1ED4.RN9 \ xbap..xbap_a3b509f224248913_0001.0000_b4daec195415e959 \ XBAPWPFTry1.exe.config第4行)---> System.Security.SecurityException:该程序集不允许部分受信任的调用方.在System.Security.CodeAccessSecurityEngine.ThrowSecurityException(组件asm,已授予PermissionSet,拒绝PermissionSet,RuntimeMethodHandle rmh,SecurityAction操作,对象需求,IPermission permThatFailed)处.在System.Reflection.MethodBase.PerformSecurityCheck(对象obj,RuntimeMethodHandle方法,IntPtr父级,UInt32 invocationFlags)处在System.RuntimeType.CreateInstanceImpl处(布尔publicOnly,布尔skipVisibilityChecks,布尔fillCache)在System.Activator.CreateInstance(类型类型,布尔型非公共)处在System.Configuration.TypeUtil.CreateInstanceWithReflectionPermission(Type type)处在System.Configuration.ConfigurationElement.CreateElement(类型类型)处在System.Configuration.ConfigurationElement.get_Item(ConfigurationProperty prop)处在System.Configuration.ConfigurationElement.Reset(ConfigurationElement parentElement)处在System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionImpl处(RuntimeConfigurationRecord configRecord,FactoryRecord factoryRecord,SectionRecord sectionRecord,Object parentConfig,ConfigXmlReader阅读器)在System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionWithRestrictedPermissions处(RuntimeConfigurationRecord configRecord,FactoryRecord factoryRecord,SectionRecord sectionRecord,Object parentConfig,ConfigXmlReader阅读器)处在System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSection处(布尔输入IsTrusted,RuntimeConfigurationRecord configRecord,FactoryRecord factoryRecord,SectionRecord sectionRecord,Object parentConfig,ConfigXmlReader阅读器)在System.Configuration.RuntimeConfigurationRecord.CreateSection处(布尔输入IsTrusted,FactoryRecord factoryRecord,SectionRecord sectionRecord,Object parentConfig,ConfigXmlReader阅读器)在System.Configuration.BaseConfigurationRecord.CallCreateSection处(布尔输入IsTrusted,FactoryRecord factoryRecord,SectionRecord sectionRecord,Object parentConfig,ConfigXmlReader阅读器,字符串文件名,Int32行) 客户端配置: < system.serviceModel> < bindings> < basicHttpBinding> < binding name =" BasicHttpBinding_IService1" closeTimeout ="00:01:00" &nsp openTimeout ="00:01:00" receiveTimeout ="00:10:00" sendTimeout ="00:01:00" &nsp allowCookies ="false" BypassProxyOnLocal ="false"; hostNameComparisonMode ="StrongWildcard" &nsp maxBufferSize ="65536". maxBufferPoolSize ="524288" maxReceivedMessageSize ="65536"<&bb messageEncoding =文本" textEncoding ="utf-8"; transferMode =缓冲的" useDefaultWebProxy ="true"> &b < readerQuotas maxDepth ="32" maxStringContentLength ="8192" maxArrayLength ="16384" maxBytesPerRead ="4096". maxNameTableCharCount ="16384"; /> <安全模式=无"><&bsp;&nsp ; < transport clientCredentialType ="None" proxyCredentialType =无" realm =" /> b ; < message clientCredentialType =" UserName" algorithmSuite =默认" /> </security> </binding> </basicHttpBinding> </bindings> < client> < endpoint address =" wnyc2ua6520rzj.iam.intranet/XBAPWCFTry1/Service1.svc " binding ="basicHttpBinding" bindingConfiguration ="BasicHttpBinding_IService1" 合同="WCFTest1.IService1"名称="BasicHttpBinding_IService1"; /> </client> </system.serviceModel>

System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for system.serviceModel/bindings: That assembly does not allow partially trusted callers. (C:\Documents and Settings\VGoyal\Local Settings\Apps\2.0\Q0WJXK1Q.T5M\W5NR1ED4.RN9\xbap..xbap_a3b509f224248913_0001.0000_b4daec195415e959\XBAPWPFTry1.exe.config line 4) ---> System.Security.SecurityException: That assembly does not allow partially trusted callers. at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) at System.Reflection.MethodBase.PerformSecurityCheck(Object obj, RuntimeMethodHandle method, IntPtr parent, UInt32 invocationFlags) at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Configuration.TypeUtil.CreateInstanceWithReflectionPermission(Type type) at System.Configuration.ConfigurationElement.CreateElement(Type type) at System.Configuration.ConfigurationElement.get_Item(ConfigurationProperty prop) at System.Configuration.ConfigurationElement.Reset(ConfigurationElement parentElement) at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionImpl(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader) at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader) at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSection(Boolean inputIsTrusted, RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader) at System.Configuration.RuntimeConfigurationRecord.CreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader) at System.Configuration.BaseConfigurationRecord.CallCreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader, String filename, Int32 line)Client Config: <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="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="wnyc2ua6520rzj.iam.intranet/XBAPWCFTry1/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1" contract="WCFTest1.IService1" name="BasicHttpBinding_IService1" /> </client> </system.serviceModel>

推荐答案

VikasGoyal1, -> System.Configuration.ConfigurationErrorsException:为system.serviceModel/bindings创建配置节处理程序时发生错误:该程序集不允许部分受信任的调用方. 根据错误消息,无法在部分受信任模式下访问一个程序集,因此我们最好在完全受信任模式下对其进行调用. 谢谢.此致. Hi VikasGoyal1,-->System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for system.serviceModel/bindings: That assembly does not allow partially trusted callers. According to the error message, one assembly cannot be accessed in the partial trusted mode, so we'd better call it in full trusted mode.Thanks.Sincerely.

更多推荐

带有WCF错误的WPF XBAP(该程序集不允许部分受信任的调用方.)

本文发布于:2023-11-05 08:44:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560394.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不允许   错误   程序   WCF   XBAP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!