This repository was archived by the owner on Apr 8, 2020. It is now read-only.
File tree 2 files changed +7
-3
lines changed
src/Microsoft.AspNetCore.NodeServices/Configuration
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ public static void Main(string[] args) {
21
21
// Since .NET Core 1.1, the HTTP hosting model has become basically as fast as the Socket hosting model
22
22
//options.UseSocketHosting();
23
23
24
- options . ProjectPath = Directory . GetCurrentDirectory ( ) ;
25
24
options . WatchFileExtensions = new string [ ] { } ; // Don't watch anything
26
25
} ) ;
27
26
var serviceProvider = services . BuildServiceProvider ( ) ;
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
+ using System . IO ;
3
4
using System . Threading ;
4
5
using Microsoft . AspNetCore . NodeServices . HostingModels ;
5
6
using Microsoft . Extensions . Logging ;
@@ -34,14 +35,18 @@ public NodeServicesOptions(IServiceProvider serviceProvider)
34
35
InvocationTimeoutMilliseconds = DefaultInvocationTimeoutMilliseconds ;
35
36
WatchFileExtensions = ( string [ ] ) DefaultWatchFileExtensions . Clone ( ) ;
36
37
37
- // In an ASP.NET environment, we can use the IHostingEnvironment data to auto-populate a few
38
- // things that you'd otherwise have to specify manually
39
38
var hostEnv = serviceProvider . GetService < IHostingEnvironment > ( ) ;
40
39
if ( hostEnv != null )
41
40
{
41
+ // In an ASP.NET environment, we can use the IHostingEnvironment data to auto-populate a few
42
+ // things that you'd otherwise have to specify manually
42
43
ProjectPath = hostEnv . ContentRootPath ;
43
44
EnvironmentVariables [ "NODE_ENV" ] = hostEnv . IsDevelopment ( ) ? "development" : "production" ; // De-facto standard values for Node
44
45
}
46
+ else
47
+ {
48
+ ProjectPath = Directory . GetCurrentDirectory ( ) ;
49
+ }
45
50
46
51
var applicationLifetime = serviceProvider . GetService < IApplicationLifetime > ( ) ;
47
52
if ( applicationLifetime != null )
You can’t perform that action at this time.
0 commit comments