Deploy XBAP Application?

2020-06-06 07:44发布

问题:

We have a WPF Application that has a two flavors with a consistent UI etc,one that runs from a Windows OS Desktop and one that is supposed to run as an XBAP application.

Currently I am publishing the XBAP application to my localhost machine IIS (Windows XP Pro),Also I have enabled full trust in my scenario as it is needed(Microsoft .NET Framework 2.0 Configuration,URL Full trust) + pfx file(for my machine name) that gets installed when a user on another machine types the URL from the IE browser on his machine.

Say I want to sell the XBAP application to a customer since he wants a centralized app rather than a desktop one then how will I go about it? Can someone with XBAP deployment experience tell me ? Should I make a setup that will set up the application on his web server and that's it? (assuming web server has .net 3.5 sp1) What about pfx and full trust should I tell him to do that ?

回答1:

I have worked in a similar situation of using ClickOnce as the engine to deploy the binaries as XBAP as well as standard WPF. To install the XBAP website at a customer site, we would have an installer create the virtual directory in IIS and then run a custom step to sign the ClickOnce manifests. This step was necessary as the application needed to access a generated configuration file that contained information about the customer environment.

Here are some notes on issues that I've seen with using XBAP.

  • Dependency of Framework v3.0 or higher on the Client's workstation. (More of a general note when dealing with WPF, as unless you are using a controlled desktop, you may have to deploy this as well)
  • Inexplicably the user's ClickOnce cache would be invalidated, requiring the user to have to clear their cache using: rundll32 %windir%\system32\dfshim.dll CleanOnlineAppCache
  • Bad installation of Framework v3.0/Internet Explorer requires the user's profile to be recreated, dotNet framework to be reinstalled, or Internet Explorer be reinstalled.
  • Poor error messages from ClickOnce when deployments would fail. A lot of times it would report a general Deployment Exception, and the fix would be one of the above steps.
  • When using any authentication in front of the website, such as ASP.Net forms auth, IIS trusted (not on intranet), or a proxy like ISA, there is an issue within the Microsoft stack where IE will not be able to pass authentication to the ClickOnce engine. The problem, is that IE will successfully authenticate, but will be unable to pass the security context to ClickOnce. When ClickOnce tries to deploy the application files, it will have no security context, and authentication will fail. But if you go to Internet Options --> Security--> select 'Local Intranet' --> Click 'Custom level...' You will see a list of Settings. Scroll to the bottom of the list and Under User Authentication --> Logon --> make sure that the option 'Automatic logon with current user name and password' is selected. This should allow IE to pass authentication info to the click once applications.


回答2:

To run the XBAP application, your client also needs to run .NET framework. It's not possible to run XBAPs without .NET Framework installed.

By default only partial trust permission is granted to your application. To enable FullTrust, you either need to grant the permission to your application URL on the client:

caspol -m -ag 1 -url "http://server/app/*" FullTrust -exclusive on

or you could add the security certificate to the client trusted certificates. A step by step guide is available here: How to run WPF - XBAP as Full Trust Application.