Javascriptservices(带有Node.js的ASP.NET核心)在部署到IIS后无法正常运行

时间:2018-07-10 12:46:51

标签: node.js asp.net-core javascriptservices

很抱歉,如果缺少任何信息。

我正在使用节点模块API将图形导出到在IIS中无法使用的png。

为了进行测试,我尝试使用opn nodejs API打开png图像。在本地Visual Studio 2017 IIS Express中运行良好。但是在发布到IIS后无法正常工作。

我收到以下错误消息。

  

连接ID“ 0HLF748N5JA33”,请求ID“ 0HLF748N5JA33:00000003”:   应用程序引发了未处理的异常。   System.AggregateException:发生一个或多个错误。 (节点   60000ms后,调用超时。您可以更改超时   通过将InvocationTimeoutMilliseconds属性设置为on来设置持续时间   NodeServicesOptions。

     

第一步调试是确保您的Node.js功能正常   始终调用提供的回调(或引发异常)   同步),即使遇到错误也是如此。否则,.NET   代码无法知道它完成还是失败。)--->   Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException:   60000ms后,节点调用超时。您可以更改   通过设置InvocationTimeoutMilliseconds属性来设置超时时间   在NodeServicesOptions上。

     

第一步调试是确保您的Node.js功能正常   始终调用提供的回调(或引发异常)   同步),即使遇到错误也是如此。否则,.NET   代码无法知道它已完成还是失败。在   Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.d__13 1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>d__10 1.MoveNext()   ---从上一个引发异常的位置开始的堆栈跟踪-   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()在   Microsoft.AspNetCore.NodeServices.NodeServicesImpl.d__10 1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter 1.GetResult()   在   SizingServerAPIV2.Controllers.GraphPlotter.d__2.MoveNext()   在   C:\ Repository \ libdrivesizing \ libdrivesizing \ private \ projects \ win-vs2015 \ SizingServerAPIV2 \ Controllers \ GraphPlotter.cs:line   113 ---内部异常堆栈跟踪的结尾---   System.Threading.Tasks.Task 1.GetResultCore(Boolean waitCompletionNotification) at SizingServerAPIV2.Controllers.ProductController.GetMotionProfileGraph(String data) in C:\Repository\libdrivesizing\libdrivesizing\private\projects\win-vs2015\SizingServerAPIV2\Controllers\ProductApi.cs:line 425 at lambda_method(Closure , Object , Object[] ) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextResourceFilter>d__22.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeFilterPipelineAsync>d__17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeAsync>d__15.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.<Invoke>d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.<Invoke>d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.<Invoke>d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.<Invoke>d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.<Invoke>d__11.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Frame 1.d__2.MoveNext()   --->(内部异常#0)Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException:   60000ms后,节点调用超时。您可以更改   通过设置InvocationTimeoutMilliseconds属性来设置超时时间   在NodeServicesOptions上。

cs代码

   public async Task<string> TestNodeMules()
    {
        // setup the services
        var services = new ServiceCollection();
        services.AddNodeServices(options =>
        {
            options.ProjectPath = Directory.GetCurrentDirectory();
            // Set any properties that you want on 'options' here
        });

        var serviceProvider = services.BuildServiceProvider();
        var nodeServices = serviceProvider.GetRequiredService<INodeServices>();



        var result = await nodeServices.InvokeAsync<string>("./GraphPlottingServerSideJS2/app.js");



        return result;

    }

JavaScript Nodejs代码

const opn = require('opn');




module.exports = function(callback){

  // Opens the image in the default image viewer
opn('graph2.png').then(() => {
  // image viewer closed
  callback(null,"success");
})
.catch(err => {
  callback(null,"success"); 
  });

}

0 个答案:

没有答案