Building an Office Web Apps (OWA) WOPI Host

This solution gives you a simple WOPI Host that provides viewing, and editing through Office Web Apps via a custom WOPI Server. Illustrates the implementation of WOPI for a Server in a working example.

C# (2.7 MB)
3,081 times
Add to favorites
E-mail Twitter Digg Facebook
Sign in to ask a question

  • Sorry, Word Web App ran into a problem opening this document.....
    1 Posts | Last post June 17, 2015
    • ... To view this document please open it in Microsoft Word.
      Hi ! So here's my issue :/ I've used your template (Wich is **** great !) and I managed to use it for excels for now. In fact, the rest should work finely, but it's not :/.
      First, i'm gonna show you what i changed. In the Get method from the FilesController (on /api/wopi/files/{name}/contents then), i had to get the content of "http" files. (like So i changed your FileStream reading method with a WebClient reading Method. 
      This `using (WebClient client = new WebClient())
                          client.Credentials = CredentialCache.DefaultNetworkCredentials;
                          tmp = client.DownloadData(name);
                      //this.DownloadString(name, out status);
                      responseMessage.Content = new ByteArrayContent(tmp);`
      replaces this : `var stream = new FileStream(file, FileMode.Open, FileAccess.Read);
            responseMessage.Content = new StreamContent(stream);`
      Works finely for excels ! but i got this issue with word & ppt. What's even more weird, is that when i call 'myserv/api/wopi/files/myFileUrl/contents' it downloads me the files (which is logical) and the ppt isn't valid, but the word IS ! I can open the downloaded word files in my microsoft word, which means that my "reading method" isn't failing (at least for word files). But i still cannot open is through my Word OWA :/ Any idea ? Does this happened to anyone ?
  • Hi Shawn, thank you for this example.
    1 Posts | Last post June 05, 2015
    • In my case I have a rest JAVA web application, and I want to make it my WOPI host.
      Is it integrable ? especially for Cobalt who is MS-FSSHTTP ?
      Sorry for my english 
  • Any pla
    1 Posts | Last post June 03, 2015
    • Thank you, Shawn! Unfortunately viewing the documents via is not enough in my case. I need to enable online editing of documents stored in document management system (DMS).
      I also have SharePoint Online Plan with Office 365 (I see that it is using for OWA). My DMS users also has an SharePoint Online or Office 365 Plan. This is somewhat disappointing that they can not use OWA from Online Plan to edit documents in my DMS. As far as I understand Microsoft intentionally limited this ability. Do you know if there are any plans to enable for access from third-party OWIN hosts?
  • One Drive / Office Online can be used as WOPI client?
    3 Posts | Last post June 03, 2015
    • As far as I see Office Online supports WOPI discovery on
      I replaced the Discovery.xml with the one from
      Than updated appWopiServer parameter, to be my Azure website url. Finally deployed the solution to Azure. 
      But no success. The server says "Sorry, we could not open this presentation because we run into a problem. Please ty again.". Any ideas if could be used for viewing/editing documents at all?
    • You can try this site instead:
      The has other protections in place.
      Any URL put in must be anonymous though and reachable via the internet of course.
    • Here's a shortcut.
  • Wopi Host not working on online files
    3 Posts | Last post May 15, 2015
    • Hi !
      First, thanks for this nice sample, helped me a lot ! :), but i still got a little problem.
      In fact, i manage to generate my preview for the files that are in the ~/App_Data/ of the project, but i can't get it to "network" files.
      For example: 
      The file a.xlsx is in my ~/App_Data/ folder., this url is working: http://officewebapps/x/_layouts/xlviewerinternal.aspx?WOPISrc=MyWopiHost%2fapi%2fwopi%2ffiles%2fa.xlsx&access_token=MOmeMP%2bPPMs%3dxcx70BhkfGuhushq%2f%2bpH57YTbXwVoZITqluDhbmYkTM%3d. (That's the result when i try "a.xlsx" on the "FrameView". Works fine, loads the preview !
      Sadly, when i put this file on a server "http://MyServerUrl/a.xlsx" and i use this path to generate the URL, it's failing. (The Web App is loading, but y got "Server Error in '/x' Application"). I tried to change the samples url (where you're using the"~/App_Data/" path) by only using my input path, but it doesn't change anything :/
      Am i simply missing something in the code, or is there a tricky thing to do ?
      Thanks for your help !
    • I just thought about something. Is it possible that it doesn't work cause my only net-zone in my discovery file is an "internal-http" ?
    • I suspect that the Service Principal that OWA is running under doesn't have permissions to the share where the files are.
      Best thing to do is look at the OWA logs and backtrace the failures in the logs. They are usually very explicit as to the failure.  Worst case run Wireshark and analyze the traffic to the network share.
      At least, when you say "network" i'm assuming you're trying to get to \\sharename\path files.
  • should we publish this sample on the server that web app server has been installed?
    5 Posts | Last post April 30, 2015
    • i didn't undrestand excactly. i want to know if i have to publish your sample web application on my server. because your code is ipmlementation of wopi host . so if we install web app server on windows server after that should we publish the wopi host on server ? 
    • The WOPI Host is installed on 1 server.  OWA is installed on the other.  For the sample you "start" from the WOPI Host main pages where you can test sample files, etc.  Upload a file, etc. and then click the "link" and it will then do a redirect for the User's browser to OWA, then OWA does the back-end negotiation, REST calls to WOPI Host, etc. to display in the User's browser (where the address bar is now OWA server).
      You have to review the WOPI spec to get a better understanding of the interactions.
    • Really tnx for your attention. I run your sample and the link that is generated is:
     is the server that OWA has been installed on, and localhost:32876  is the IIS address that I run your sample and I consider it as WOPI host ... is it true? now  I can see that ms-word is trying to be opened in my browser ... and i can see the toolbox and etc, am I right up to now ? 
    • Localhost will on work if OWA is on the same machine as the WOPI host. Either change the DNS name or deploy both to the same machine.
      Look at adding bindings to ii's express if that's what you're using.
    • Really tnx Shawn... you helped me alot ... i appreciate it . 
  • how can i create file in IIS
    1 Posts | Last post April 27, 2015
    • Hi Shawn. Tnx for your nice guid but I have a problem. in web.config in 'appWopiServer' key we have this value :  value="" />
      I want to know how can i create api/wopi/files  directory?  when i installed office web apps server a website with the name "HTTP80" was created in IIS. now i have a server with this IP :  but i dont know how to continue to show docx in web browser 
  • Do we need to always provide SHA256 in get response for CheckFileinfo?
    1 Posts | Last post December 31, 2014
    • I am going through WOPI interface document which says SHA256 is optional attribute to be return as part of get file info.
      I just want to send it as empty string or hash of my file name because downloading file from my server take some time and one more thing get file info has been called multiple times and I don't want to put those stuff in my w3process carche?
  • Hello Shawn,Are there any plants to build an OWA WOPI Host by using Spring MVC?
    1 Posts | Last post December 03, 2014
    • Hello Shawn,Are there any plants to build an OWA WOPI Host by using Spring MVC?
  • Editing word documents
    9 Posts | Last post October 31, 2014
    • Hello Shawn, Are there any plans to update this sample project to support Word document editing? Thank you
    • Yes, just the schedule is "as time permits". So, no expectations on when.  I had hoped by Spring as I go through the detailed spec on cobalt 
    • we so expect Word document editing
    • we so expect Word document editing ++1
    • First off thank you for providing this WOPI Host.
      Second, please add editing! :P
    • Shawn this is incredibly helpful; thanks very much!!
      Your post implies that to get Word editing working the host needs to support Cobalt, yes? Do you know of information out there on how to implement Word editing, or is this the wild west?
    • Yes, Cobalt is MS-FSSHTTP. Which is referenced here:
      The process I follow is:
      1. Read the MS-FSSHTTP spec - which unfortunately makes me fall asleep..
      2. See how SP 2013 interacts with OWA - for this, I run network traces using Network Analyzer (fka netmon)
      3. Implement each "verb" or scenario as I go along.
      So, it's long and tedious.  Requires multiple machines as you can't have OWA and SP2013 on the same machine.
    • This a Wopi Host demo,With Cobalt(FSSHTTPB/D) support for Office Web Apps. 
      Support DOCX Editing, and also PPTX,XLSX.
      Requires Microsoft.CobaltCore.dll
    • I'm working with Marx Yu's demo and that works great! Thanx Marx.
      But i'm having trouble to convert it to Web API. Did anybody succeed in doing this with ASP Web Api?
1 - 10 of 28 Items