WopiHost
Package | Version | Downloads |
---|---|---|
WopiHost.Abstractions |
||
WopiHost.Core |
||
WopiHost.Discovery |
||
WopiHost.FileSystemProvider |
||
WopiHost.Url |
Supporters
Sponsors
Contributors
Introduction
This project is a sample implementation of a WOPI host. Basically, it allows developers to integrate custom datasources with Office Online Server (formerly Office Web Apps) or any other WOPI client by implementing a bunch of interfaces.
Features / improvements compared to existing samples on the web
- clean WebAPI built with ASP.NET Core MVC (no references to System.Web)
- uses new ASP.NET Core features (configuration, etc.)
- can be self-hosted or run under IIS
- file manipulation is extracted to own layer of abstraction (there is no dependency on System.IO)
- example implementation included (provider for Windows file system)
- file identifiers can be anything (doesn't have to correspond with the file's name in the file system)
- custom token authentication middleware
- DI used everywhere
- URL generator
- based on a WOPI discovery module
- all references are NuGets
Usage
Prerequisites
- .NET 7 SDK
- Recommended: VS Code or Visual Studio 2022
Building the app
The WopiHost app targets net7.0
exclusively.
If you need a version that's targeting an older version of .NET, check out the releases:
If you get errors saying that Microsoft.CobaltCore.*.nupkg can't be found, then just remove the reference or see the chapter Cobalt below.
Configuration
WopiHost
Parameter | Sample value | Description |
---|---|---|
Wopi:StorageProviderAssemblyName |
"WopiHost.FileSystemProvider" |
Name of assembly containing implementation of WopiHost.Abstractions interfaces |
Wopi:StorageProvider:RootPath |
".\\wopi-docs" |
Provider-specific setting used by WopiHost.FileSystemProvider (which is an implementation of IWopiStorageProvider working with System.IO) |
Wopi:UseCobalt |
true |
Whether or not to use MS-FSSHTTP for file synchronization. More details at Cobalt |
WopiHost.Web
Parameter | Sample value | Description |
---|---|---|
Wopi:HostUrl |
"http://wopihost:5000" |
URL pointing to a WopiHost instance (above). It's used by the URL generator. |
Wopi:ClientUrl |
"http://owaserver" |
Base URL of your WOPI client - typically, Office Online Server - used by the discovery module to load WOPI client URL templates |
Wopi:StorageProvider:RootPath |
"..\\..\\WopiHost\\wwwroot\\wopi-docs" |
Provider-specific setting used by WopiHost.FileSystemProvider (which is an implementation of IWopiStorageProvider working with System.IO) |
Wopi:Discovery:NetZone |
"InternalHttp" |
Determines the target zone configuration of your OOS Deployment. Values correspond with the NetZoneEnum . |
Additionally, you can use the secret storage to configure both of the apps.
Running the application
Once you've successfully built the app you can:
- run it directly from the Visual Studio using IIS Express or self-hosted.
- make sure you run both
WopiHost
andWopiHost.Web
. You can set them both as startup projects
- make sure you run both
- run it from the
cmd
- navigate to the WopiHost folder and run
dotnet run
- navigate to the WopiHost folder and run
- run it in IIS (tested in IIS 8.5)
- TODO
Compatible WOPI Clients
Running the application only makes sense with a WOPI client as its counterpart. WopiHost is compatible with the following clients:
- Office Online Server 2016 (deployment guidelines)
- Office Online https://learn.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/online/
Note that WopiHost will always be compatible only with the latest version of OOS because Microsoft also supports only the latest version.
The deployment of OOS/OWA requires the server to be part of a domain. If your server is not part of any domain (e.g. you're running it in a VM sandbox) it can be overcome by promoting your machine to a Domain Controller.
To test your OWA server follow the instructions here.
To remove the OWA instance use Remove-OfficeWebAppsMachine
.
Cobalt
In the past (in Office Web Apps 2013), some HTTP actions required support of MS-FSSHTTP protocol (also known as "cobalt"). This is no longer true with Office Online Server 2016. However, if the WOPI client discovers (via SupportsCobalt property) that the WOPI host supports cobalt, it'll take advantage of it as it's more efficient.
If you need or want your project to use Cobalt, you'll need to create a NuGet package called Microsoft.CobaltCore.nupkg containing Microsoft.CobaltCore.dll. This DLL is part of Office Web Apps 2013 / Office Online Server 2016 and its license doesn't allow public distribution and therefore it's not part of this repository. Please always make sure your OWA/OOS server and user connecting to it have valid licenses before you start using it.
Using in your web project
TODO
Extending
TODO
Known issues / TODOs
There is plenty of space for improvements in the overall architecture, implementation of the [MS-*] protocols or just finishing the TODOs in the code. Lot of refactoring still needs to be done and also the code style has to be unified. So please feel free to help me out with it :)
- Check out open issues
Contributing
https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/
License
- LICENSE.txt - License for my part of the project
- ORIGINAL_WORK_LICENSE.txt - License for Marx Yu's part of the project. This project is based on Marx Yu's project.
- NOTICE.txt - additional notes to how the licenses are applied
Useful resources
Building WOPI Host
- Official WOPI Documentation
- Official WOPI REST API Reference
- Building an Office Web Apps (OWA) WOPI Host by Shawn Cicoria + WOPI Host and url paths
- Office Online integration via WOPI Host by Richard diZerega + video
MS-FSSHTTP (Cobalt)
- https://docs.microsoft.com/en-us/openspecs/sharepoint_protocols/ms-fsshttp/6d078cbe-2651-43a0-b460-685ac3f14c45
- https://channel9.msdn.com/Events/Open-Specifications-Plugfests/Redmond-Interoperability-Protocols-Plugfest-2015/FSSHTTP-File-Synchronization-over-HTTP