JeringTech / Javascript.NodeJS

Invoke Javascript in NodeJS, from C#
Other
455 stars 43 forks source link

Connection Exception when running on Azure App Service #117

Closed hallojoe closed 3 years ago

hallojoe commented 3 years ago

We are having trouble using Jering.Javascript.NodeJS on and Azure App Service running Windows. But only in a specific scenario.

The setup we have with Jering.Javascript.NodeJS is as follows:

Azure App Service running a Windows, .NET framework 4.8, ASP.NET and using node 14.16.0(preinstalled on the App Service by default).

ASP.NET controller using Jering.Javascript.NodeJS to render JavaScript components to HTML.

Once the controller kicks in and StaticNodeJSService.InvokeFromFileAsync<string>(...); is called, then a child proces is started for node.exe under w3p.exe and Jering.Javascript.NodeJS does it magic.

It all works like a charm, and we LOVE it.

BUT when we turn on Application Insights in our Azure subscription, we run into trouble. Connections to the node.exe process times out. We can still see a child proces is started for node.exe under w3p.exe, but now Jering.Javascript.NodeJS throws a connection exception. The point in code that thows the exception is here: https://github.com/JeringTech/Javascript.NodeJS/blob/7298989a7f0897126497e37c1036bb6e5e89070f/src/NodeJS/NodeJSServiceImplementations/OutOfProcess/OutOfProcessNodeJSService.cs#L414

That won't do. So we turn off application insights, and the all is good again.

Have anyone out there experienced something somewhat similar. We would love any input .

hallojoe commented 3 years ago

We resolved our issue.

If you are running Jering.Javascript.NodeJS using node.exe included in an Azure AppService side by side with application insights, you will need to disable application insights for node, else application insights does "something" that make wait handles within Jering.Javascript.NodeJS timeout.

This can be done by adding the following configuration setting to the AppService: XDT_MicrosoftApplicationInsights_NodeJS and setting it's value to 0.

After doing this, we are able to fully enjoy the glory of Jering.Javascript.NodeJS running on an Azure AppService.

JeremyTCD commented 3 years ago

Sorry for not responding. We've been busy lately.

Really appreciate your following up. Feel free to open another issue if you have other questions :).