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)
 
 
 
 
 
(7)
3,278 times
Add to favorites
1/31/2014
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Getting "Server error - facing technical difficulties"
    1 Posts | Last post August 21, 2015
    • Hello Shawn,
      Thank you for providing this working example of a very unique concept.
      
      I have following setup:
      1. I have Office online subscription ( I am not sure where to provide the sing in information in the WOPHost application)
      1. I have setup your application wopihost on a public IP/domain name as http ( not secure).
      3. I have setup the document management system as pure web site on a public IP/domain name as http ( not secure)
      
      After I browse to the frameview page, and get a link for an existing document in the document management system I get following error.
      
      -----------------------------------------------
      The service is unavailable
      Service Unavailable
      We are currently experiencing technical difficulties.
      Please try again later.
      -----------------------------------------------
      
      Please help.
      
      Amit
  • How to make it work?
    1 Posts | Last post August 20, 2015
    • I've tried to run it and Open test document.docx to edit and it showed me:
      "The requested URL could not be retrieved
      
      
      While trying to retrieve the URL: http://owa1.wingtip.com/we/wordeditorframe.aspx? 
      
      The following error was encountered: 
      
      Unable to determine IP address from host name for owa1.wingtip.com 
      
      The dnsserver returned: 
      
      Name Error: The domain name does not exist. 
      
      This means that: 
       The cache was not able to resolve the hostname presented in the URL. 
       Check if the address is correct. 
      "
      What Should I do?
      
  • Cannot open document?
    1 Posts | Last post August 09, 2015
    • Server Error in '/x' Application.
      
      required URL paramters are not present
      
      Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
      
      Exception Details: Microsoft.Office.Web.Common.EnvironmentAdapters.FileUnknownException: required URL paramters are not present
      
      Source Error: 
      
      An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
      
      Stack Trace: 
      
      
      [FileUnknownException: required URL paramters are not present]
         Microsoft.Office.Web.Apps.Common.WopiDocument.CreateFromQuerySignature(String querySignature) +131
         Microsoft.Office.Web.Apps.Environment.WacServer.WSMainStorage.GetBaseDocumentFromContext(HttpContext context, String rawHostDocumentId) +47
         Microsoft.Office.Excel.Server.ServiceHost.ServiceHost.Microsoft.Office.Excel.Server.Host.IEwaHost.GetFileRepresentation(HttpContext context, Boolean newWorkbook) +308
         Microsoft.Office.Excel.Server.ServiceHost.ServiceHost.Microsoft.Office.Excel.Server.Host.IEwaHost.PreProcessRequest(HttpContext context) +1939
         Microsoft.Office.Excel.WebUI.XlViewerInternal.OnLoad(EventArgs e) +61
         System.Web.UI.Control.LoadRecursive() +71
         System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178
  • 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 http://myserv.com/res/test.docx). 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 http://officewebviewer.com/ 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 officeapps.live.com 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 officeapps.live.com 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 https://officeapps.live.com/hosting/discovery
      
      I replaced the Discovery.xml with the one from https://officeapps.live.com/hosting/discovery
      
      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 officeapps.live.com could be used for viewing/editing documents at all?
    • You can try this site instead: http://products.office.com/en-US/office-online/view-office-documents-online
      
      The https://officeapps.live.com has other protections in place.
      
      Any URL put in must be anonymous though and reachable via the internet of course.
    • Here's a shortcut.
      
      http://officewebviewer.com/
  • 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:
      
      http://192.168.1.103/we/wordeditorframe.aspx?WOPISrc=http%3a%2f%2flocalhost%3a32876%2fapi%2fwopi%2ffiles%2ftest.docx&access_token=fxulDnVroDU%3dOYaNSzoKYcIq1sTO8Bv2L9Cw5bJ28BYG%2fzf8E34%2bcF0%3d
      
      192.168.1.103  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="http://wopihost.wingtip.com:8888/api/wopi/files/" />
      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 : 192.168.1.103  but i dont know how to continue to show docx in web browser 
1 - 10 of 31 Items