Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Exception thrown in non aspnet core example for NodeServices #1208

Closed
@mcMickJuice

Description

@mcMickJuice

I'm following the example for using node services in a non aspnet core app. I'm getting an exception when calling InvokeAsync, related to the ProjectPath:

System.AggregateException occurred
  HResult=0x80131500
  Message=One or more errors occurred.
  Source=<Cannot evaluate the exception source>
  StackTrace:
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at NodeServices.Program.Main(String[] args) in M:\Dev\examples\test-aspnet-core-spa-template\NodeServices\NodeServices\Program.cs:line 22

Inner Exception 1:
ArgumentNullException: Value cannot be null. Parameter Path1

stack trace:

"   at System.IO.Path.Combine(String path1, String path2)\r\n 
  at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.PrepareNodeProcessStartInfo(String entryPointFilename, String projectPath, String commandLineArguments, IDictionary`2 environmentVars, Boolean launchWithDebugging, Int32 debuggingPort)\r\n  
 at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance..ctor(String entryPointScript, String projectPath, String[] watchFileExtensions, String commandLineArguments, CancellationToken applicationStoppingToken, ILogger nodeOutputLogger, IDictionary`2 environmentVars, Int32 invocationTimeoutMilliseconds, Boolean launchWithDebugging, Int32 debuggingPort)\r\n  
at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance..ctor(NodeServicesOptions options, Int32 port)\r\n  
 at Microsoft.AspNetCore.NodeServices.HostingModels.NodeServicesOptionsExtensions.<>c__DisplayClass0_0.<UseHttpHosting>b__0()\r\n   
at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.CreateNewNodeInstance()\r\n
   at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.GetOrCreateCurrentNodeInstance()\r\n   
at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>d__10`1.MoveNext()"

I dont think that ProjectPath is being set to the Project root directory. When I set ProjectPath to './', everything works:

 services.AddNodeServices(options =>
            {
                options.ProjectPath = "./";
            });

If this is truly the case, I can update the README for nodeServices to be explicit in how to use NodeServices for non aspnet core projects. For the record, the instructions for aspnet core is correct (i.e. project path is set correctly).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions