How to publish the javascriptservices project (asp.netcore rest api project which uses node api) to IIS 8. The application not wroking after publishing to IIS #29

Closed
opened 2025-08-09 17:14:43 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @jubishkammily on 7/11/2018

Hello I am stuck with this problem from last couple of days. Please help me in this if you have any information regarding this issue.

I am using JavaScriptServices in my Asp.net rest api project.

I have written a sample JavaScript test code to open image in nodejs using opn node API.
npm install opn

javascript code

    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"); 
          });
        
        }

CS Code

    public async Task<string> TestNodeMules(INodeServices nodeServices)
    {
       
        var result = await nodeServices.InvokeAsync<string>("./GraphPlottingServerSideJS2/app.js");
        return result;

    }

This is working in the local system using visual studio 2017 IIS Express.But not working after Deploying the Code to IIS 8 windows 10.

After publishing I have copied the Javacript project folder to the publish folder manually to make the javascript and node modules available for the asp.net project to access. This is not seems to be working.

I am able to get normal javascrprt code back to the c# in IIS but when I am using some API in nodemodules , the application is gettign timeout.

I have given the error messages below

fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HLF748N5JA33", Request id "0HLF748N5JA33:00000003": An unhandled exception was thrown by the
application. System.AggregateException: One or more errors occurred.
(The Node invocation timed out after 60000ms. You can change the
timeout duration by setting the InvocationTimeoutMilliseconds property
on NodeServicesOptions.

The first debugging step is to ensure that your Node.js function
always invokes the supplied callback (or throws an exception
synchronously), even if it encounters an error. Otherwise, the .NET
code has no way to know that it is finished or has failed.) --->
Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException:
The Node invocation timed out after 60000ms. You can change the
timeout duration by setting the InvocationTimeoutMilliseconds property
on NodeServicesOptions.

The first debugging step is to ensure that your Node.js function
always invokes the supplied callback (or throws an exception
synchronously), even if it encounters an error. Otherwise, the .NET
code has no way to know that it is finished or has failed. at

Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.d__131.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__101.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
Microsoft.AspNetCore.NodeServices.NodeServicesImpl.d__101.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.TaskAwaiter1.GetResult()
at
SizingServerAPIV2.Controllers.GraphPlotter.d__2.MoveNext()
in
C:\Repository\libdrivesizing\libdrivesizing\private\projects\win-vs2015\SizingServerAPIV2\Controllers\GraphPlotter.cs:line
113 --- End of inner exception stack trace --- at
System.Threading.Tasks.Task1.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.Frame1.d__2.MoveNext()
---> (Inner Exception #0) Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException:
The Node invocation timed out after 60000ms. You can change the
timeout duration by setting the InvocationTimeoutMilliseconds property
on NodeServicesOptions.

*Originally created by @jubishkammily on 7/11/2018* Hello I am stuck with this problem from last couple of days. Please help me in this if you have any information regarding this issue. I am using **JavaScriptServices** in my Asp.net rest api project. I have written a sample JavaScript test code to open image in nodejs using opn node API. npm install opn **javascript code** ``` 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"); }); } ``` **CS Code** ``` public async Task<string> TestNodeMules(INodeServices nodeServices) { var result = await nodeServices.InvokeAsync<string>("./GraphPlottingServerSideJS2/app.js"); return result; } ``` This is working in the local system using visual studio 2017 IIS Express.But not working after Deploying the Code to IIS 8 windows 10. After publishing I have copied the Javacript project folder to the publish folder manually to make the javascript and node modules available for the asp.net project to access. This is not seems to be working. I am able to get normal javascrprt code back to the c# in IIS but when I am using some API in nodemodules , the application is gettign timeout. I have given the error messages below > fail: Microsoft.AspNetCore.Server.Kestrel[13] > Connection id "0HLF748N5JA33", Request id "0HLF748N5JA33:00000003": An unhandled exception was thrown by the > application. System.AggregateException: One or more errors occurred. > (The Node invocation timed out after 60000ms. You can change the > timeout duration by setting the InvocationTimeoutMilliseconds property > on NodeServicesOptions. > > The first debugging step is to ensure that your Node.js function > always invokes the supplied callback (or throws an exception > synchronously), even if it encounters an error. Otherwise, the .NET > code has no way to know that it is finished or has failed.) ---> > Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException: > The Node invocation timed out after 60000ms. You can change the > timeout duration by setting the InvocationTimeoutMilliseconds property > on NodeServicesOptions. > > The first debugging step is to ensure that your Node.js function > always invokes the supplied callback (or throws an exception > synchronously), even if it encounters an error. Otherwise, the .NET > code has no way to know that it is finished or has failed. at > > Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.<InvokeExportAsync>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() > --- End of stack trace from previous location where exception was thrown --- at > System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at > Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>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() > at > SizingServerAPIV2.Controllers.GraphPlotter.<TestNodeMules>d__2.MoveNext() > in > C:\Repository\libdrivesizing\libdrivesizing\private\projects\win-vs2015\SizingServerAPIV2\Controllers\GraphPlotter.cs:line > 113 --- End of inner exception stack trace --- at > 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.<ProcessRequestsAsync>d__2.MoveNext() > ---> (Inner Exception #0) Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException: > The Node invocation timed out after 60000ms. You can change the > timeout duration by setting the InvocationTimeoutMilliseconds property > on NodeServicesOptions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#29
No description provided.