Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/326.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Azure应用程序提供HRESULT E_失败已从对COM组件的调用中返回_C#_Asp.net_Azure - Fatal编程技术网

C# Azure应用程序提供HRESULT E_失败已从对COM组件的调用中返回

C# Azure应用程序提供HRESULT E_失败已从对COM组件的调用中返回,c#,asp.net,azure,C#,Asp.net,Azure,我有一个基于websocket的文本编辑器,是我为一个大学项目编写的。在我的本地机器上运行良好,但部署到Azure时会出现错误 将html转换为rtf时会出现问题,我混合使用了来自和的代码。这需要在单线程单元中使用windows窗体组件,这有点让人头疼,但它确实有效……直到我迁移到Azure 在Visual studio中调试时,我收到错误消息: System.Runtime.InteropServices.COMException was unhandled ErrorCode=-2147

我有一个基于websocket的文本编辑器,是我为一个大学项目编写的。在我的本地机器上运行良好,但部署到Azure时会出现错误

将html转换为rtf时会出现问题,我混合使用了来自和的代码。这需要在单线程单元中使用windows窗体组件,这有点让人头疼,但它确实有效……直到我迁移到Azure

在Visual studio中调试时,我收到错误消息:

System.Runtime.InteropServices.COMException was unhandled
  ErrorCode=-2147467259
  HResult=-2147467259
  Message=Error HRESULT E_FAIL has been returned from a call to a COM component.
  Source=System.Windows.Forms
  StackTrace:
       at System.Windows.Forms.UnsafeNativeMethods.IWebBrowser2.Navigate2(Object& URL, Object& flags, Object& targetFrameName, Object& postData, Object& headers)
       at System.Windows.Forms.WebBrowser.PerformNavigate2(Object& URL, Object& flags, Object& targetFrameName, Object& postData, Object& headers)
       at System.Windows.Forms.WebBrowser.set_Url(Uri value)
       at System.Windows.Forms.WebBrowser.set_DocumentStream(Stream value)
       at System.Windows.Forms.WebBrowser.set_DocumentText(String value)
       at RealTimeTextEditor.HtmlRtfConvertor.ConvertHtmltoRtf(Object obj) in C:\DissertationProjectGitRepo\RealTimeTextEditor\RealTimeTextEditor\HtmlRtfConvertor.cs:line 30
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart(Object obj)
  InnerException: 
在这里可以找到有问题的代码,异常发生在“tempBrowser.DocumentText=data.html

调用html转换器类的控制器代码:

        HtmlRtfConvertor convertor = new HtmlRtfConvertor();
        convertor.ThreadConvertor(path, html);

Web应用程序沙箱中限制了对进程外COM的访问

更多关于这方面的信息,请参见我的其他答案-

您在哪里部署:web应用程序?云服务(网络/工作者)?vm?@David Makogon-这是一个连接到sql数据库的web应用程序。感谢您的输入,我已经阅读了有关Azure沙盒的文章,非常有用。我想这意味着我将不得不研究另一个托管解决方案?我是Azure新手,请原谅我的无知。正确。查看Azure云服务(Web角色)或虚拟机(IaaS)。下面是一个将Web项目转换为在Web角色(云服务)中运行的简便指南--
        HtmlRtfConvertor convertor = new HtmlRtfConvertor();
        convertor.ThreadConvertor(path, html);