2

WPF 4(.NET 4)で新しいプロジェクトを開始し、xbapモードで実行できるかどうかを確認しようとしています。.NET 4で利用できるようになった新しいモードを使用して、アプリケーションを完全信頼で実行する必要があります。このモードでは、完全信頼アプリケーションを実行する必要があるかどうかをエンドユーザーに尋ねます。

「セキュリティ」モードを「完全信頼」アプリケーションに設定しましたが、問題なくビルドされます。実行すると、例外がスローされ、IEエラーメッセージに次のエラーが表示されます。

それを回避する方法はありますか?

スタートアップURI:T:\ projects \ Hightech Sources \ PayRoll \ PayRoll.Web \ publish \ PayRoll.Web.xbap
アプリケーションID:file:/// T:/projects/Hightech%20Sources/PayRoll/PayRoll.Web/publish/PayRoll.Web.xbap#PayRoll.Web.xbap、Version = 1.0.0.0、Culture = neutral、PublicKeyToken = 1d910f49755d2c97 、processorArchitecture = msil / PayRoll.Web.exe、Version = 1.0.0.0、Culture = neutral、PublicKeyToken = 1d910f49755d2c97、processorArchitecture = msil、type = win32

System.Security.SecurityException:タイプ'System.Security.Permissions.FileIOPermission、mscorlib、Version = 4.0.0.0、Culture = neutral、PublicKeyToken=b77a5c561934e089'のアクセス許可の要求が失敗しました。
   System.Security.CodeAccessSecurityEngine.Check(オブジェクトデマンド、StackCrawlMark&stackMark、ブールisPermSet)で
   System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap、StackCrawlMark&stackMark)で
   System.Security.CodeAccessPermission.Demand()で
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef、Evidence assemblySecurity、StackCrawlMark&stackMark、Boolean forIntrospection、BooleansuppressSecurityChecks)で
   System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile、Evidence securityEvidence、Byte [] hashValue、AssemblyHashAlgorithm hashAlgorithm、Boolean forIntrospection、BooleansuppressSecurityChecks、StackCrawlMark&stackMark)で
   System.Reflection.Assembly.LoadFrom(String assemblyFile)で
   PayRoll.Web.App.SelectAssemblies()で
   Caliburn.PresentationFramework.ApplicationModel.CaliburnApplication..ctor()で
   PayRoll.Web.App..ctor()で
   PayRoll.Web.App.Main()で
   System.AppDomain._nExecuteAssembly(RuntimeAssemblyアセンブリ、String [] args)で
   System.AppDomain.nExecuteAssembly(RuntimeAssemblyアセンブリ、String [] args)で
   System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)で
   System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()で
   System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext ActivationContext、String [] ActivationCustomData)で
   System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext ActivationContext)で
   System.Windows.Interop.PresentationApplicationActivator.CreateInstance(ActivationContext actCtx)で
   System.Activator.CreateInstance(ActivationContext ActivationContext)で
   System.AppDomain.Setup(Object arg)で
   System.AppDomain.nCreateInstance(文字列friendlyName、AppDomainSetupセットアップ、エビデンス提供セキュリティ情報、エビデンス作成者セキュリティ情報、IntPtr parentSecurityDescriptor)
   System.Runtime.Hosting.ApplicationActivator.CreateInstanceHelper(AppDomainSetup adSetup)で
   System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext ActivationContext、String [] ActivationCustomData)で
   System.Windows.Interop.PresentationApplicationActivator.CreateInstance(ActivationContext actCtx)で
   System.Activator.CreateInstance(ActivationContext ActivationContext)で
   System.Deployment.Application.DeploymentManager.ExecuteNewDomain()で
   System.Deployment.Application.InPlaceHostingManager.Execute()で
   MS.Internal.AppModel.XappLauncherApp.ExecuteDownloadedApplication()で
   System.Windows.Interop.DocObjHost.RunApplication(ApplicationRunner runner)で
   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(Object arg)で
   System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback、Object args、Int32 numArgs)で
   MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(オブジェクトソース、デリゲートメソッド、オブジェクト引数、Int32 numArgs、デリゲートcatchHandler)で
   System.Windows.Threading.DispatcherOperation.InvokeImpl()で
   System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)で
   System.Threading.ExecutionContext.runTryCode(Object userData)で
   System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code、CleanupCode backoutCode、Object userData)で
   System.Threading.ExecutionContext.RunInternal(ExecutionContextexecutionContext、ContextCallbackコールバック、オブジェクト状態)で
   System.Threading.ExecutionContext.Run(ExecutionContext executeContext、ContextCallbackコールバック、オブジェクト状態、ブール値ignoreSyncCtx)で
   System.Threading.ExecutionContext.Run(ExecutionContextexecutionContext、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&handled)で
   MS.Win32.HwndWrapper.WndProc(IntPtr hwnd、Int32 msg、IntPtr wParam、IntPtr lParam、Boolean&handled)で
   MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)で
   System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback、Object args、Int32 numArgs)で
   MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(オブジェクトソース、デリゲートメソッド、オブジェクト引数、Int32 numArgs、デリゲートcatchHandler)で
   System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority、TimeSpan timeout、Delegate method、Object args、Int32 numArgs)で
   MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd、Int32 msg、IntPtr wParam、IntPtr lParam)で
   MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG&msg)で
   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(Delegate callback、Object args、Int32 numArgs)で
   MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(オブジェクトソース、デリゲートメソッド、オブジェクト引数、Int32 numArgs、デリゲートcatchHandler)で
   System.Windows.Threading.DispatcherOperation.InvokeImpl()で
   System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)で
   System.Threading.ExecutionContext.runTryCode(Object userData)で
   System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code、CleanupCode backoutCode、Object userData)で
   System.Threading.ExecutionContext.RunInternal(ExecutionContextexecutionContext、ContextCallbackコールバック、オブジェクト状態)で
   System.Threading.ExecutionContext.Run(ExecutionContext executeContext、ContextCallbackコールバック、オブジェクト状態、ブール値ignoreSyncCtx)で
   System.Threading.ExecutionContext.Run(ExecutionContextexecutionContext、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&handled)で
   MS.Win32.HwndWrapper.WndProc(IntPtr hwnd、Int32 msg、IntPtr wParam、IntPtr lParam、Boolean&handled)で
   MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)で
   System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback、Object args、Int32 numArgs)で
   MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(オブジェクトソース、デリゲートメソッド、オブジェクト引数、Int32 numArgs、デリゲートcatchHandler)で
   System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority、TimeSpan timeout、Delegate method、Object args、Int32 numArgs)で
   MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd、Int32 msg、IntPtr wParam、IntPtr lParam)で
失敗したアクションは次のとおりです。
要求する
失敗した最初の権限のタイプは次のとおりです。
System.Security.Permissions.FileIOPermission
4

1 に答える 1

1

完全信頼の自己署名 xbap アプリケーションを実行するために私が見つけた唯一の方法は、クライアントのマシンに証明書を追加するか (ほとんどの場合は不可能かもしれません)、サイトの URL を信頼済みサイトのリストに追加することです。私は後者が最も便利であり、信頼できる機関によって発行された有効な証明書によって署名されているかのようにアプリケーションが実行されることがわかりました。

これは .NET 4.0 でのみ可能であり、以前のバージョンの WPF/.NET では機能しないことに注意してください。

于 2011-05-25T05:46:18.520 に答える