我已经在 WPF 4 (.NET 4) 中启动了一个新项目,并尝试查看是否可以在 xbap 模式下运行它。我需要使用 .NET 4 中提供的新模式以完全信任运行应用程序,该模式询问最终用户是否应该运行完全信任应用程序。
我已将“安全”模式设置为“完全信任”应用程序,它构建得很好。当我运行它时,会引发异常并且 IE 错误消息显示以下错误。
有什么办法吗??
启动 URI:T:\projects\Hightech Sources\PayRoll\PayRoll.Web\publish\PayRoll.Web.xbap 应用程序标识:file:///T:/projects/Hightech%20Sources/PayRoll/PayRoll.Web/publish/PayRoll.Web.xbap#PayRoll.Web.xbap,Version=1.0.0.0,Culture=neutral,PublicKeyToken=1d910f49755d2c97 ,处理器架构=msil/PayRoll.Web.exe,版本=1.0.0.0,文化=中性,PublicKeyToken=1d910f49755d2c97,处理器架构=msil,类型=win32 System.Security.SecurityException:请求“System.Security.Permissions.FileIOPermission,mscorlib,版本=4.0.0.0,文化=中性,PublicKeyToken=b77a5c561934e089”类型的权限失败。 在 System.Security.CodeAccessSecurityEngine.Check(对象需求,StackCrawlMark& stackMark,布尔 isPermSet) 在 System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission 上限、StackCrawlMark 和 stackMark) 在 System.Security.CodeAccessPermission.Demand() 在 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,证据 assemblySecurity,StackCrawlMark 和 stackMark,Boolean for Introspection,Boolean suppressSecurityChecks) 在 System.Reflection.RuntimeAssembly.InternalLoadFrom (字符串 assemblyFile,证据 securityEvidence,Byte [] hashValue,AssemblyHashAlgorithm hashAlgorithm,Boolean for Introspection,Boolean suppressSecurityChecks,StackCrawlMark 和 stackMark) 在 System.Reflection.Assembly.LoadFrom(字符串 assemblyFile) 在 PayRoll.Web.App.SelectAssemblies() 在 Caliburn.PresentationFramework.ApplicationModel.CaliburnApplication..ctor() 在 PayRoll.Web.App..ctor() 在 PayRoll.Web.App.Main() 在 System.AppDomain._nExecuteAssembly(RuntimeAssembly 程序集,字符串 [] 参数) 在 System.AppDomain.nExecuteAssembly(RuntimeAssembly 程序集,字符串 [] 参数) 在 System.Runtime.Hosting.ManifestRunner.Run(布尔 checkAptModel) 在 System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly() 在 System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext,字符串 [] activationCustomData) 在 System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext 激活上下文) 在 System.Windows.Interop.PresentationApplicationActivator.CreateInstance(ActivationContext actCtx) 在 System.Activator.CreateInstance(ActivationContext 激活上下文) 在 System.AppDomain.Setup(对象 arg) 在 System.AppDomain.nCreateInstance(字符串友好名称,AppDomainSetup 设置,证据提供安全信息,证据创建者安全信息,IntPtr parentSecurityDescriptor) 在 System.Runtime.Hosting.ApplicationActivator.CreateInstanceHelper(AppDomainSetup adSetup) 在 System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext,字符串 [] activationCustomData) 在 System.Windows.Interop.PresentationApplicationActivator.CreateInstance(ActivationContext actCtx) 在 System.Activator.CreateInstance(ActivationContext 激活上下文) 在 System.Deployment.Application.DeploymentManager.ExecuteNewDomain() 在 System.Deployment.Application.InPlaceHostingManager.Execute() 在 MS.Internal.AppModel.XappLauncherApp.ExecuteDownloadedApplication() 在 System.Windows.Interop.DocObjHost.RunApplication(ApplicationRunner 亚军) 在 MS.Internal.AppModel.XappLauncherApp.XappLauncherApp_Exit(对象发送者,ExitEventArgs e) 在 System.Windows.Application.OnExit(ExitEventArgs e) 在 System.Windows.Application.DoShutdown() 在 System.Windows.Application.ShutdownImpl() 在 System.Windows.Application.ShutdownCallback(对象 arg) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托回调,对象 args,Int32 numArgs) 在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(对象源,委托方法,对象 args,Int32 numArgs,委托 catchHandler) 在 System.Windows.Threading.DispatcherOperation.InvokeImpl() 在 System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(对象状态) 在 System.Threading.ExecutionContext.runTryCode(对象 userData) 在 System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode 代码,CleanupCode backoutCode,对象 userData) 在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,ContextCallback 回调,对象状态) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态,布尔 ignoreSyncCtx) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态) 在 System.Windows.Threading.DispatcherOperation.Invoke() 在 System.Windows.Threading.Dispatcher.ProcessQueue() 在 System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam,Boolean& 处理) 在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam,Boolean& 处理) 在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(对象 o) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托回调,对象 args,Int32 numArgs) 在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(对象源,委托方法,对象 args,Int32 numArgs,委托 catchHandler) 在 System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority 优先级,TimeSpan 超时,委托方法,对象 args,Int32 numArgs) 在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam) 在 MS.Win32.UnsafeNativeMethods.DispatchMessage(味精和味精) 在 System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame 框架) 在 System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame 框架) 在 System.Windows.Threading.Dispatcher.Run() 在 System.Windows.Application.RunDispatcher(对象忽略) 在 System.Windows.Application.StartDispatcherInBrowser(对象未使用) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托回调,对象 args,Int32 numArgs) 在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(对象源,委托方法,对象 args,Int32 numArgs,委托 catchHandler) 在 System.Windows.Threading.DispatcherOperation.InvokeImpl() 在 System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(对象状态) 在 System.Threading.ExecutionContext.runTryCode(对象 userData) 在 System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode 代码,CleanupCode backoutCode,对象 userData) 在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,ContextCallback 回调,对象状态) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态,布尔 ignoreSyncCtx) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态) 在 System.Windows.Threading.DispatcherOperation.Invoke() 在 System.Windows.Threading.Dispatcher.ProcessQueue() 在 System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam,Boolean& 处理) 在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam,Boolean& 处理) 在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(对象 o) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托回调,对象 args,Int32 numArgs) 在 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(对象源,委托方法,对象 args,Int32 numArgs,委托 catchHandler) 在 System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority 优先级,TimeSpan 超时,委托方法,对象 args,Int32 numArgs) 在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd,Int32 msg,IntPtr wParam,IntPtr lParam) 失败的动作是: 要求 第一个失败的权限类型是: System.Security.Permissions.FileIOPermission