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)
2,793 times
Add to favorites
E-mail Twitter Digg Facebook
Sign in to ask a question

  • 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?
  • Special characters in file name
    2 Posts | Last post August 21, 2014
    • There are test files in demo in app_data folder - I am able to view those files rendered by OWA. 
      However, if I put into app_data folder file with special character ']' - "[AzureLab.docx]" for example, then demo creates url
      (its decoded value looks normal:[AzureLab].docx&access_token=kl3ANR2/aUg=u5zivYTkdFvz5OI+Gr/0ScqCgqhUu/hllBpFfD21+u8=
      but after clicking on produced url OWA shows standard errors message about problem with opening.
      Also - for regular files when I click on produced link, I can debug app - it hits breakpoint in 
      [Route("files/{name}/")] public CheckFileInfo GetFileInfo
      and with special chars in the name it does not hit breakpoint but OWA returns error right away.
      I guess produced access_token is not right (logic in KeyGen::GetHash ?), OWA cannot match it... - is that the reason why OWA does not call wopihost?
      Can you please advise on how to fix such issue.
      Thanks a lot.
    • I found how to convert in file name "[" ,"]" (double encoding), but for percent sign '%' it does not work...
  • cobalt and word editing
    2 Posts | Last post July 16, 2014
    • Hi
      I have been following these posts. 
      http: // / questions / 17065029 / can-i-just-use-office-web-apps-server
      And there is ample description of enabling word edits via Cobalt but no matter what I try it just will not enter edit mode.
      Has anyone else managed to pass this point and if so can I get some direction on what needs doing ?
    • 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 cannot edit word files with the sample
    2 Posts | Last post June 25, 2014
    • Hi there
      For some reason I don't understand, the word part of the sample doesn't work with our Microsoft Web Apps 2013 Server installation. Excel and Powerpoint work like a charm however. I always get the message and then nothing further happes:
      "Dieses Dokument kann leider nicht zum Bearbeiten geöffnet werden".
      In english:
      "Unforunately this document cannot be opened in edit mode".
      I don't see any error or exception in any server logs, it simply doesn't work.
      Doesn't anyone have what the source of this problem might be?
      Best regards
    • I just realized that Word Editing is not part of the solution. Where do I start implementing this. I read the entire offical documentatio:[MS-WOPI].pdf, yet I have absolutely no idea what I have to make different for editing word files, compared to excel and powerpoints. :-(
  • this wopi host suport connections external?
    2 Posts | Last post June 09, 2014
    • I have updated the connections and  occurred a warning:  
      This workbook contains external data or BI features that are not supported connections.
    • Hi,
      Is possible use this wopi host for BI with connections external?
1 - 10 of 24 Items