zyx204 / WopiHost

ASP.NET Core MVC implementation of the WOPI protocol. Enables integration with WOPI clients like Office Web Apps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction

Build status codecov Gitter

This project is an example 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 few 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

Building the app

The WopiHost app targets net46 and netcoreapp1.0. You can choose which one you want to use. If you get errors that Microsoft.CobaltCore.15.0.0.0.nupkg can't be found then just remove the reference or see the chapter "Cobalt" below.

Configuration

WopiHost.Web\Properties\launchSettings.json

  • WopiHostUrl - used by URL generator
  • WopiClientUrl - used by the discovery module to load WOPI client URL templates

WopiHost\Properties\launchSettings.json

  • WopiFileProviderAssemblyName - name of assembly containing implementation of WopiHost.Abstractions interfaces
  • WopiRootPath - provider-specific setting used by WopiFileSystemProvider (which is an implementation of IWopiFileProvider working with System.IO)
  • server.urls - hosting URL(s) used by Kestrel. Read more...

Running the application

Once you've successfully built the app you can:

  • run it directly from the Visual Studio using IIS Express or selfhosted.
    • make sure you run both WopiHost and WopiHost.Web. You can set them both as startup projects
  • run it from the cmd
    • navigate to the WopiHost folder and run dotnet run
  • run it in IIS (tested in IIS 8.5)
    • navigate to the WopiHost folder and run dnu publish --runtime active
    • copy the files from WopiHost\bin\output to your desired web application directory
    • run the web.cmd file as administrator, wait for it to finish and close it (Ctrl+C and y)
    • create a new application in IIS and set the physical path to the wwwroot in the web application directory
    • make sure the site you're adding it to has a binding with port 5000
    • go to the application settings and change the value of dnx clr to clr and the value of dnx-version to 1.0.0-rc1
    • in the same window, add all the configuration settings

Compatible WOPI Clients

Running the application only makes sense with a WOPI client as its counterpart. WopiHost is compatible with the following clients:

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 overcame e.g. by installing DC role. After it's deployed you can safely remove the role and the OWA server will remain functional. 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 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 use it as it's more efficient.

If you want to make the project work with Office Web Apps 2013 SP1 (deployment guidelines), you'll need to create a NuGet package called Microsoft.CobaltCore.15.0.0.0.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 make sure your OWA/OOS server and user connecting to it have valid licenses before you start using it.

  1. Locate Microsoft.CobaltCore.dll (you can find it in the GAC of the OWA server): C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.CobaltCore\
  2. Install NuGet Package Explorer
  3. Use .nuspec located in the Microsoft.CobaltCore folder to create new package
  4. Put the .nupkg to your local NuGet feed
  5. Configure Visual Studio to use your local NuGet feed

Note: the Microsoft.CobaltCore.dll targets the full .NET Framework, it's not possible to use it in an application that targets .NET Core.

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 :)

Contributing

https://msdn.microsoft.com/en-us/library/ms229042(v=vs.110).aspx

License

Support the project

If this project helped you and you want to support its further development, please consider donating an amount of your choice. Thank you!

Donate with PayPal

Useful resources

Building WOPI Host

FSSHTTP

Other relevant resources

Building WOPI Client

About

ASP.NET Core MVC implementation of the WOPI protocol. Enables integration with WOPI clients like Office Web Apps.

License:Other


Languages

Language:C# 56.9%Language:PowerShell 42.1%Language:JavaScript 0.7%Language:CSS 0.2%Language:HTML 0.1%