0

I'm using asp.net core 2.2 and INodeServices for interoperability between C# and Node. The problem is that my Node invocation works great on my development environment, but once I push my code to Azure App Service and then execute the invocation (trough an MVC controller), it seems unable to locate the Node code to execute and after waiting a bit, it throws an error.

I've found by using Kudu that my node_modules Folder, as well as my Node folder, don't get copied to the publish directory on deployment unless I configure them to do so by setting the following code on my .csproj file.

this doesn't seem to solve the problem, but i think that my NodeCode Folder should be deployed next to my node_nodules because of dependencies.

Thanks for your time.

As of right now, the INodeServices invocation works great on my development environment, but once deployed to Azure, it fails after a long wait.

    <Content Include="NodeCode\ePaycoCash.js">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="NodeCode\ePaycoCustomers.js">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="NodeCode\ePaycoPayments.js">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="NodeCode\ePaycoPlans.js">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="NodeCode\ePaycoPSE.js">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="NodeCode\ePaycoSubscriptions.js">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="NodeCode\ePaycoTokens.js">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content> 
    <Content Include="node_modules\**">
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
</ItemGroup>`


Update:


under LogFiles/DetailedErrors I found this:

Most likely causes:

IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.

IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
IIS was not able to process configuration for the Web site or application.
The authenticated user does not have permission to use this DLL.
The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.

Things you can try:

Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.

Check the event logs to see if any additional information was logged.
Verify the permissions for the DLL.

Install the .NET Extensibility feature if the request is mapped to a managed handler.

Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.
4
  • Update: The server reports "The specified CGI application encountered an error and the server terminated the process." when it fails, but sometimes it just throws an x500. 😥 Apr 7, 2019 at 1:38
  • The error message it too general, is there any demo to reproduce your issue? Share us detail steps to reproduce your issue.
    – Edward
    Apr 9, 2019 at 6:02
  • @TaoZhou, Thanks for your response. I am invoking a NodeJS Script through INodeServices in an MVC Controller. This relies on my NodeCode folder which contains those invoked scripts. This folder, as well as my node_modules Folder, are located at my project's folder, so in development, it works great. But after deployment to Azure, my node_modules and my NodeCode folders seem to be inaccessible, or, in some cases (depending on my .csproj file as shown above) unpublished, which causes an error. Apr 14, 2019 at 4:59
  • You can try two things 1. Open Kudu, access site\wwwroot folder, and start installing your packages on Azure using npm. 2. Copy node_modules to any sub folder (of site\wwwroot\wwwroot), this will ensure the folder gets deployed. Now open Kudu console and move this folder to wwwroot. This works best because you have same version of modules in development and Azure environment.
    – ASN
    Aug 12, 2019 at 14:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.