简体   繁体   English

通过POST服务在C#异步方法中调用Edge.func时出现ERR_CONNECTION_RESET错误

[英]ERR_CONNECTION_RESET error when calling Edge.func in C# async method through POST service

I have also raised an issue in the github pages for Edge, linked here https://github.com/tjanczuk/edge/issues/579 我还在Edge的github页面中提出了一个问题,链接到这里https://github.com/tjanczuk/edge/issues/579

I am trying to utilize Edge in my .NET application to run a quick node program to do some minor video processing. 我正在尝试在.NET应用程序中利用Edge来运行一个快速的节点程序来执行一些次要的视频处理。

I have verified that the javascript works - tested it independently running 'node test.js'. 我已经验证了javascript可以正常运行-测试了它是否独立运行“ node test.js”。 And I have verified that I am calling and using the Edge.func method properly by creating a small C# console app and testing to see if, when I run it in CMD (testApp.exe), the video processing works through node using Edge (it does). 并且我已经通过创建一个小型C#控制台应用程序并测试以查看是否在CMD(testApp.exe)中运行它时,是否通过使用Edge的节点正常工作了视频处理,来正确调用并使用Edge.func方法它确实)。

The problem is that when I try to run the async method shown below through my POST web service using Edge I get the first log - 'In Edge Task' - but I never get the log at the bottom - 'in async call' - and client side I get a network error saying failed net::ERR_CONNECTION_RESET. 问题是,当我尝试使用Edge通过POST Web服务运行下面显示的异步方法时,我得到了第一个日志-“在Edge任务中”-但我从不获得日志的底部-“在异步调用中”-并且客户端,我收到一个网络错误,提示失败了net :: ERR_CONNECTION_RESET。

public static async Task Start()
{
    LogManager.Instance.WriteLog("In Edge Task");
    var func = Edge.Func(@"
        var ffmpeg = require('fluent-ffmpeg');
        return function (data, callback) {
            var proc2 = ffmpeg('testFile-0.webm')
                .input('testFile-1.webm')
                .on('error', function(err) {
                    callback(null, 'ERRORRRR');
                })
                .on('end', function() {
                    callback(null, '');
                })
                .mergeToFile('merged-fromNET.mp4', 'tempDir');
        }
    ");
    LogManager.Instance.WriteLog("in async call");
    await func(null);
}

This async task Start() method works properly if I call it from my test console app... 如果我从测试控制台应用程序调用它,则此异步任务Start()方法将正常工作...

I have verified my post service is set up correctly because without executing this method using Start.Wait(), commenting it out, the service executes properly. 我已经验证了我的邮政服务设置正确,因为没有使用Start.Wait()执行此方法,将其注释掉,该服务将正确执行。 I have installed the necessary node modules and the used video files and necessary dlls in the proper directories so I am sure that is not the issue. 我已经在适当的目录中安装了必要的节点模块以及使用的视频文件和必要的dll,因此我确定这不是问题。

Please help, thank you for your time. 请帮助,谢谢您的时间。

So I figured out the answer to my question with the help of this question - Starting a process with credentials from a Windows Service 因此,我借助此问题找出了问题的答案- 使用Windows服务中的凭据启动进程

It seems that a web service is executed with "Network Service" permissions and upon checking windows event viewer I was getting an access violation - meaning I needed to execute this chunk of code as a user with proper permissions. 似乎已使用“网络服务”权限执行了Web服务,并且在检查Windows事件查看器时遇到访问冲突-这意味着我需要以具有适当权限的用户身份执行这段代码。 So I followed the logic provided in the question I linked to in order to create a process that would execute a simple exe I set up to execute the chunk of code I posted. 因此,我遵循所链接问题中提供的逻辑,以创建一个流程,该流程将执行一个简单的exe,我将其设置为执行我发布的代码块。 I had to be careful to give my user proper permissions to access the folder with the exe and that was pretty much it. 我必须谨慎地授予我的用户适当的权限,以使用exe访问该文件夹,仅此而已。

With this technique, it seems easy to set up a web service that executes node.js logic with Edge https://github.com/tjanczuk/edge - Thanks tjanczuk 借助这种技术,似乎很容易设置可通过Edge https://github.com/tjanczuk/edge执行node.js逻辑的Web服务-谢谢tjanczuk

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

相关问题 WCF Restfull服务调用错误方法-ERR_CONNECTION_RESET - error calling method from WCF Restfull Service - ERR_CONNECTION_RESET 从C#Web API方法下载ZipArchive在Chrome中返回“ net :: ERR_CONNECTION_RESET” - Download ZipArchive from c# web api method returns “net::ERR_CONNECTION_RESET” in chrome 错误101(net :: ERR_CONNECTION_RESET):连接已重置 - Error 101 (net::ERR_CONNECTION_RESET): The connection was reset net :: ERR_CONNECTION_RESET 200(确定),当执行GET方法时 - net::ERR_CONNECTION_RESET 200 (OK) when doing GET method 得到 <URL> 网:: ERR_CONNECTION_RESET - GET <URL> net::ERR_CONNECTION_RESET 如何解决Edge.Func挂起? - How to resolve Edge.Func hanging? 对 ASP.NET MVC 控制器的 Ajax POST 调用给出 net::ERR_CONNECTION_RESET - Ajax POST call to ASP.NET MVC controller giving net::ERR_CONNECTION_RESET 我的web api只从ajax客户端发出net :: ERR_CONNECTION_RESET错误 - My web api gives net:: ERR_CONNECTION_RESET error only from ajax client 尝试访问ASP.NET Web App项目上的localhost时出现ERR_CONNECTION_RESET - ERR_CONNECTION_RESET when trying to access localhost on ASP.NET Web App project JavaScript获取请求错误:无法加载资源:net :: ERR_CONNECTION_RESET - JavaScript get request error: Failed to load resource: net::ERR_CONNECTION_RESET
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM