How to run WPF – XBAP as Full Trust Application

Recently I work on WPF-XBAP application that will run from intranet website:

 How to run WPF – XBAP as Full Trust Application_第1张图片

This application must have unrestricted access to client's OS resources (that is unusual for XBAP projects):

How to run WPF – XBAP as Full Trust Application_第2张图片

I publish it on local website by using "Click-Once" deployment mechanism:

How to run WPF – XBAP as Full Trust Application_第3张图片

User can launch the application from deployment page (also can run application setup):

How to run WPF – XBAP as Full Trust Application_第4张图片

I get security error ("User has refused to grant required permissions to the application"):

How to run WPF – XBAP as Full Trust Application_第5张图片

Means that application tried to perform some restricted action, beyond of XBAP sandbox. Actually it tried to read local video file:

How to run WPF – XBAP as Full Trust Application_第6张图片

(It reads video file from local source, for preview option before uploading it to FTP server)

After some research I found how to fix that:

(1) Project must be signed with "Click-Once" manifest (security certificate file):

How to run WPF – XBAP as Full Trust Application_第7张图片

(If project doesn't contain "Test Certificate" click on rounded button to create a new one)

(2) After temporary certificate was created we'll save it into file (click on "More Details"):

How to run WPF – XBAP as Full Trust Application_第8张图片

File export wizard (step A):

How to run WPF – XBAP as Full Trust Application_第9张图片

File export wizard (step B):

How to run WPF – XBAP as Full Trust Application_第10张图片

File export wizard (step C): 
(Enter username and password, only if you did so while "Test Certificate" creation in par. 1)

How to run WPF – XBAP as Full Trust Application_第11张图片

File export wizard (step D):

How to run WPF – XBAP as Full Trust Application_第12张图片

File export wizard (step E):

How to run WPF – XBAP as Full Trust Application_第13张图片

File export wizard (step F):

How to run WPF – XBAP as Full Trust Application_第14张图片

(Now project certificate is saved as external file)

(3) Now we'll go to Internet Explorer and will register this certificate: 
(Open "Internet Options" from "Tools" menu)

How to run WPF – XBAP as Full Trust Application_第15张图片

Click on "Certificates" in "Content" tab:

How to run WPF – XBAP as Full Trust Application_第16张图片

Import certificate file from "Trusted Root Certification Authorities" tab:

How to run WPF – XBAP as Full Trust Application_第17张图片

File import wizard (step A):

How to run WPF – XBAP as Full Trust Application_第18张图片

File import wizard (step B):

How to run WPF – XBAP as Full Trust Application_第19张图片

File import wizard (step C):

How to run WPF – XBAP as Full Trust Application_第20张图片

File import wizard (step D):

How to run WPF – XBAP as Full Trust Application_第21张图片

Confirm importing:

How to run WPF – XBAP as Full Trust Application_第22张图片

If succeed you'll get this window:

 How to run WPF – XBAP as Full Trust Application_第23张图片

And will see certificate here:

How to run WPF – XBAP as Full Trust Application_第24张图片

Do same in "Trusted Publishers" tab:

How to run WPF – XBAP as Full Trust Application_第25张图片

Close IE options:

 How to run WPF – XBAP as Full Trust Application_第26张图片

(6) No we'll go to "Signing" tab in project options and will select registered certificate:

How to run WPF – XBAP as Full Trust Application_第27张图片

Select registered certificate from local store:

How to run WPF – XBAP as Full Trust Application_第28张图片

(5) Republish the application:

How to run WPF – XBAP as Full Trust Application_第29张图片

How to run WPF – XBAP as Full Trust Application_第30张图片

Now XBAP can run in "Full Trusted" mode:

How to run WPF – XBAP as Full Trust Application_第31张图片

Hope this post was helpful ;-)

from:http://blogs.microsoft.co.il/maxim/2008/03/05/how-to-run-wpf-xbap-as-full-trust-application/

你可能感兴趣的:(application)