2017-10-08 58 views
0

我正在开发ASP.net web api(.NET Framework)并使用“Microsoft Office Document Imaging”v12。 在我的本地系统上,它工作正常。但后来我把它放在我的天蓝色的web应用程序,我得到了以下错误:使用“Microsoft Office Document Imaging”获取Azure Web App上的错误

Could not load file or assembly 'Interop.MODI, Version=12.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

我敢肯定,我必须安装“微软Office Document Imaging中”。但是,当我仅使用Azure Web App时,我该怎么做?


编辑:我发现了一个更好的方法来解决我的问题:https://azure.microsoft.com/de-de/services/cognitive-services/computer-vision/

回答

0

据我所知,我们没有安装“Microsoft Office文档图像”(使用许可Sharepoint安装包)在天蓝色的网络应用程序。

Azure的web应用程序env作为sanbox,有几个严格的限制和限制,我们不能将它用作azure虚拟机。更多细节,你可以参考这个article

如果您仍然想使用“Microsoft Office Document Imaging”,我建议您可以考虑使用Azure虚拟机,我们有完全权限来更改env。

此外,我想你会将文档转换为图像。我建议您可以尝试使用Aspose.Words for .NET将文档转换为图像或PDF。

这个包可以安装在Nuget包中。

更多细节,你可以参考下面的测试演示代码。

 string location = Server.MapPath("/exe/"); 
     Document document = new Document(Server.MapPath("/exe/bbbb.docx")); 
     ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Png); 
     options.PageCount = 1; 

     // Save each page of the document as Png. 
     for (int i = 0; i < document.PageCount; i++) 
     { 
      options.PageIndex = i; 
      document.Save(string.Format(location+ @"\out_{0}.png", i), options); 
     } 

结果:

enter image description here

+0

谢谢您的回答! 我使用MODI从文档/图像中提取单词。Aspose.Words也可以吗? 我看到也有Aspose.OCR,但它的成本太高,我的需求.. –

+0

我建议你可以考虑使用天蓝色的虚拟机。正如我上面的天蓝色网络应用沙箱[链接](https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox#unsupported-frameworks)所说,天蓝色的网络应用只支持第三方转换工具。所以如果你使用sadbox不支持的工具,你将面临同样的错误。 –

相关问题