简体   繁体   English

如何获取一个wopi主机集成的file_id?

[英]How to get the file_id of a wopi host integration?

I've deployed a Wopi client as mentioned in the documentation and now i'm trying to deploy a wopi host, but i'm new to .net enviroment and i don't know how to get the file hosted in wopi-docs folder.我已经按照文档中的说明部署了一个 Wopi 客户端,现在我正在尝试部署一个 wopi 主机,但我是 .net 环境的新手,我不知道如何将文件托管在 wopi-docs 文件夹中。 (It seems to be encrypted but i don't know how to get the files in that folder) (它似乎是加密的,但我不知道如何获取该文件夹中的文件)

I have done the next steps:我已经完成了接下来的步骤:

  1. I implemented an office online server according the official documentation.我按照官方文档实现了一个office在线服务器。 (Wopi client) (沃皮客户端)
  2. I tried the discovery URL and it worked perfectly.我尝试了发现 URL,它运行良好。
  3. I deployed a wopi host according to this repo.我根据这个 repo 部署了一个 wopi 主机。 (Wopi host and a great repo by the way) (Wopi 主机和一个很棒的 repo)
  4. Cloned the repo in the server.在服务器中克隆回购协议。
  5. I removed Cobalt project from solution from command line in the root directory.我从根目录中的命令行从解决方案中删除了 Cobalt 项目。
  6. I rebuilt the solution from command line in the root directory.我从根目录中的命令行重建了解决方案。
  7. I ran WopiHost project from command line in the WopiHost directory.我从 WopiHost 目录中的命令行 运行了WopiHost 项目。
  8. I ran WopiHost.Web project from command line in the WopiHost.Web directory.我从 WopiHost.Web 目录中的命令行 运行WopiHost.Web 项目。
  9. I tried Wopi integration with a wopi host page (i don't know if it's correct, but at least it seems to work partially) like this:我尝试将 Wopi 与wopi 主机页面集成(我不知道它是否正确,但至少它似乎部分工作)是这样的:
<!doctype html>
<html>

<head>
    <meta charset="utf-8">

    <!-- Enable IE Standards mode -->
    <meta http-equiv="x-ua-compatible" content="ie=edge">

    <title></title>
    <meta name="description" content="">
    <meta name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">

    <link rel="shortcut icon" href="https://my-server-url.com/wv/resources/1033/FavIcon_Word.ico" />

    <style type="text/css">
        body {
            margin: 0;
            padding: 0;
            overflow: hidden;
            -ms-content-zooming: none;
        }

        #office_frame {
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            margin: 0;
            border: none;
            display: block;
        }
    </style>
</head>

<body>

    <form id="office_form" name="office_form" target="office_frame" action="https://my-server-url.com/wv/wordviewerframe.aspx?ui=es-mx&rs=es-mx&dchat=1&showpagestats=1&IsLicensedUser=1&WOPISrc=http%3A%2F%2Fmy-server-url.com%3A5000%2Fwopi%2Ffiles%2Ftest.docx" method="post">
        <input name="access_token" value="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIxMjM0NSIsInVuaXF1ZV9uYW1lIjoiQW5vbnltb3VzIiwiZW1haWwiOiJhbm9ueW1vdXNAZG9tYWluLnRsZCIsIlVzZXJQZXJtaXNzaW9ucyI6IlVzZXJDYW5BdHRlbmQsIFVzZXJDYW5QcmVzZW50LCBVc2VyQ2FuUmVuYW1lLCBVc2VyQ2FuV3JpdGUiLCJuYmYiOjE2MTA2MDU5NDgsImV4cCI6MTYxMDYwOTU0OCwiaWF0IjoxNjEwNjA1OTQ4fQ.KbxGcTVOa3yWCGcEHEGv9MRP_NskfViW_vyMTOupRO4" type="hidden" />
        <input name="access_token_ttl" value="0" type="hidden" />
    </form>

    <span id="frameholder"></span>

    <script type="text/javascript">
        var frameholder = document.getElementById('frameholder');
        var office_frame = document.createElement('iframe');
        office_frame.name = 'office_frame';
        office_frame.id = 'office_frame';

        // The title should be set for accessibility
        office_frame.title = 'Office Frame';

        // This attribute allows true fullscreen mode in slideshow view
        // when using PowerPoint's 'view' action.
        office_frame.setAttribute('allowfullscreen', 'true');

        // The sandbox attribute is needed to allow automatic redirection to the O365 sign-in page in the business user flow
        office_frame.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-forms allow-popups allow-top-navigation allow-popups-to-escape-sandbox');
        frameholder.appendChild(office_frame);

        document.getElementById('office_form').submit();
    </script>

</body>

</html>

And the result that i get is the following error:我得到的结果是以下错误: 在此处输入图像描述

Does anyone know how to get the correct name of the files to put into the html file above or how do i get the wopi host web?有谁知道如何获取文件的正确名称以放入上面的 html 文件或如何获取 wopi 主机 web?

Thanks in advance.提前致谢。

The file ID in my repo is just base64 encoded .我的回购协议中的文件 ID 只是base64 编码 To verify that you're using the correct path, just take the base64 value and pass it to a decoder or write your own utility to decode it.要验证您使用的路径是否正确,只需获取 base64 值并将其传递给解码器或编写您自己的实用程序来对其进行解码。 The ID should be opaque to the WOPI client (Office Online Server) - it accepts it an passess it back to the WOPI host which can undertand it and return the right file. ID 对 WOPI 客户端(Office Online Server)应该是不透明的 - 它接受它并将其传递回 WOPI 主机,后者可以理解它并返回正确的文件。 I recommend putting breakpoints to GetCheckFileInfo and GetFile methods to see if they're being hit correctly and what data they return.我建议在 GetCheckFileInfo 和 GetFile 方法中放置断点,以查看它们是否被正确命中以及它们返回的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM