问题
On my old XP computer, running an XBAP from Visual Studio would open it up in Google Chrome. I switched to Windows 7, and now running an XBAP downloads the file like it were a ZIP or an EXE instead of opening it in the browser. The same thing happens in FireFox.
Does anyone know why I am suddenly downloading the file instead of opening it? And how I can fix it?
And yes, I know XBAPs are not meant to run on Chrome, but if you copy a bunch of FireFox dlls to the Google\Chrome\Application directory it runs just fine (steps here if anyone wants).
Even before I had that setup, it would still try and open an xbap in chrome and I could copy the URL to IE for testing. Now it downloads the file so I can't even do that.
回答1:
Got it... Firefox (and Chrome, since I'm using FF dlls to run XBAPs in Chrome) runs XBAPs by using a dll from the .Net 3.5 Installer, and since Windows 7 comes with 3.5 already installed, this dll isn't available
To fix this, I needed to copy the file
C:\WINDOWS\Microsoft.NET\Framework\v3.5\Windows Presentation Foundation\NPWPF.dll
from an XP machine to
C:\Program Files (x86)\Mozilla Firefox\plugins
(if FireFox folder doesn't exist, create it)
Also in case you're looking to do the same, I think this was the link I used to figure out what FF files I needed to copy to Chrome's installation directory:
The following libraries found in Mozilla Firefox instalation directory
C:\Program Files\Mozilla Firefox
have to be coppied to Chrome installation directory:
- js3250.dll
- mozcrt19.dll
- nspr4.dll
- nss3.dll
- nssutil3.dll
- plc4.dll
- plds4.dll
- smime3.dll
- sqlite3.dll
- ssl3.dll
- xpcom.dll
- xul.dll
Assumming Chrome is installed in the following directory, USER corresponds to your windows user.
C:\Users\[USER]\AppData\Local\Google\Chrome\Application
回答2:
MIME Type Extension
application/manifest .manifest
application/x-ms-xbap .xbap
application/octet-stream .deploy
application/x-ms-application .application
application/vnd.ms-xpsdocument .xps
application/xaml+xml .xaml
Maybe it is related with the file extentsions?
来源:https://stackoverflow.com/questions/7337155/how-can-i-get-my-xbap-to-run-in-my-browser-instead-of-downloading-it-on-windows