Azure storage files ShareClient throwing an exception - azure

Created a sample console application and I am trying to connect to Azure file storage using this code.
var connectionString = "DefaultEndpointsProtocol=https;AccountName=<account-name>;AccountKey=<account-key>;EndpointSuffix=core.windows.net;";
var shareClient = new ShareClient(connectionString, "testfileshare");
shareClient.CreateIfNotExists();
the share name "testfileshare" exists in the account and "CreateIfNotExists()" method call throwing AggregateException with message
"Retry failed after 6 tries" with InnerException message "The
underlying connection was closed: An unexpected error occurred on a
send."
I am using Azure.Storage.Files.Shares, 12.4.0 version. Target framework is .NET4.6.2. Tried updating target framework to .NET4.7.2 but getting same error.
Why am I getting this error?
Adding stack trace:
at Azure.Core.Pipeline.RetryPolicy.<ProcessAsync>d__11.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Azure.Core.Pipeline.RetryPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
at Azure.Core.Pipeline.HttpPipeline.Send(HttpMessage message, CancellationToken cancellationToken)
at Azure.Storage.Files.Shares.FileRestClient.Share.<CreateAsync>d__0.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Azure.Storage.Files.Shares.ShareClient.<CreateInternal>d__31.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Azure.Storage.Files.Shares.ShareClient.<CreateIfNotExistsInternal>d__34.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Azure.Storage.Files.Shares.ShareClient.CreateIfNotExists(IDictionary`2 metadata, Nullable`1 quotaInGB, CancellationToken cancellationToken)
at FileStorageTest.Program.Main(String[] args) in C:\Tests\FileStorageTest\FileStorageTest\Program.cs:line 24

I have found the issue. When I add Azure.Storage.Files.Shares package reference from nuget I observed that in project file Azure.Core reference is adding from "net461" folder and others are adding from "netstandard2.0" folder and my application target framework is "Net4.6.2"
This causing the issue. When I manually changed Azure.Core reference path to "netstandard2.0" it is working fine.
<Reference Include="Azure.Core, Version=1.5.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
<!--<HintPath>..\packages\Azure.Core.1.5.0\lib\net461\Azure.Core.dll</HintPath>-->
<HintPath>..\packages\Azure.Core.1.5.0\lib\netstandard2.0\Azure.Core.dll</HintPath>
</Reference>
I have reproduced this issue by upgrading "Azure.Storage.Files.Shares" package. I do not know whether it is VS issue or nuget issue.

Related

Azure App Service has exception during snapshot upload and stops working correctly

I have a Problem where a App Service is temporary unavailable. But its a bit special...
The App is running but one task of the app is to send e mails via a Mail Provider - Mailgun. And from time to time it isn't sending mails. We have checked the mailgun and there is no problem and when I restart this App Service all mails are sent.
So I search a lot and find a log from the snapshot uploader in the app service where an exception occurs approximately at the same time when the mail service is not working.
The Exception is the following:
SnapshotUploader.exe Error: 0 : Exception during dump processing:
Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (503) Server Unavailable. ---> System.Net.WebException: The remote server returned an error: (503) Server Unavailable.
at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[T](HttpStatusCode expectedStatusCode, HttpStatusCode actualStatusCode, T retVal, StorageCommandBase`1 cmd, Exception ex)
at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.<PutBlockImpl>b__5c(RESTCommand`1 cmd, HttpWebResponse resp, Exception ex, OperationContext ctx)
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse[T](IAsyncResult getResponseResult)
--- End of inner exception stack trace ---
Server stack trace:
at Microsoft.WindowsAzure.Storage.Core.Util.StorageAsyncResult`1.End()
at Microsoft.WindowsAzure.Storage.Blob.BlobWriteStream.EndWrite(IAsyncResult asyncResult)
at System.IO.Compression.DeflateStream.WriteDeflaterOutput(Boolean isAsync)
at System.IO.Compression.DeflateStream.InternalWrite(Byte[] array, Int32 offset, Int32 count, Boolean isAsync)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
Exception rethrown at [0]:
at Microsoft.WindowsAzure.Storage.Blob.BlobWriteStream.Flush()
at Microsoft.WindowsAzure.Storage.Blob.BlobWriteStream.Commit()
at Microsoft.WindowsAzure.Storage.Blob.BlobWriteStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at System.IO.Stream.Dispose()
at Microsoft.ApplicationInsights.SnapshotCollector.Uploader.Uploader.<UploadFileToBlobCompressed>d__47.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ApplicationInsights.SnapshotCollector.Uploader.Uploader.<UploadBlobWithRetriesAsync>d__46.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.ApplicationInsights.SnapshotCollector.Uploader.Uploader.<UploadMinidumpAsync>d__41.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ApplicationInsights.SnapshotCollector.Uploader.Uploader.<ProcessOneDumpFileAsync>d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ApplicationInsights.SnapshotCollector.Uploader.Uploader.<RunMainLoopAsync>d__21.MoveNext()
Request Information
RequestID:da887501-801e-006f-3c95-121388000000
RequestDate:Wed, 26 Jan 2022 09:19:38 GMT
StatusMessage:Ingress is over the account limit.
ErrorCode:ServerBusy
ErrorMessage:Ingress is over the account limit.
RequestId:da887501-801e-006f-3c95-121388000000
Time:2022-01-26T09:19:38.4648110Z
Is it possible that this exception blocks the app service or something so it cant work correctly? And how can I fix this Exception?

Octopus Deploy: Operation returned an invalid status code 'Conflict'

I followed this guide to deploy to Azure through Azure Devops and Octopus Deploy. It worked the first two deploys, but when I did some new changes I now get the following error message:
The step failed: Activity Deploy an Azure Web App on AspDotNetCore failed with error 'The remote script failed with exit code 100'.
Deploying to Azure WebApp 'MyAPI' in Resource Group 'MyApp', using subscription-id '<Subscription ID>'
Running rollback behaviours...
Operation returned an invalid status code 'Conflict'
Microsoft.Azure.Management.WebSites.Models.DefaultErrorResponseException
at Microsoft.Azure.Management.WebSites.WebAppsOperations.
<ListPublishingProfileXmlWithSecretsWithHttpMessagesAsync>d__148.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Microsoft.Azure.Management.WebSites.WebAppsOperationsExtensions.
<ListPublishingProfileXmlWithSecretsAsync>d__287.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 Calamari.AzureWebApp.Integration.Websites.Publishing.ResourceManagerPublishProfileProvider.
<GetWebDeployPublishProfile>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 Calamari.AzureWebApp.Integration.Websites.Publishing.ResourceManagerPublishProfileProvider.
<GetPublishProperties>d__2.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 Calamari.AzureWebApp.AzureWebAppBehaviour.<Execute>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 Calamari.Common.Plumbing.Pipeline.PipelineCommand.<ExecuteBehaviour>d__16.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 Calamari.Common.Plumbing.Pipeline.PipelineCommand.<Execute>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Calamari.Common.Plumbing.Pipeline.PipelineCommand.<Execute>d__13.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 Calamari.Common.CalamariFlavourProgramAsync.<Run>d__4.MoveNext()
The remote script failed with exit code 100
The action Deploy an Azure Web App on AspDotNetCore failed
Does anyone know what the problem is?
My subscription to Azure was disabled (without notice).
We've identified suspicious activity in this subscription. To protect your account, we've disabled the subscription. Please contact Azure Support to resolve the issue.
EDIT: When the Azure subscription was re-enabled (again without notice) I could deploy my package on Octopus and now everything works again as expected.

Win 10 -> VS 2019 -> .NET Core 3 WPF application -> Publish to directory (self-contained for linux-x64) -> Publish failed

Weird issue I've faced today.
Pre-requisites:
Installed:
VS2019
.NET Core 3.0
Steps to reproduce the issue:
Create new "WPF App (.NET Core)"
To the MainWindow.xaml add single TextBlock:
<TextBlock Text="WPF on Linux" TextWrapping="Wrap"/>
Create new Publish Profile like the following:
Then save and publish
Expected to see the application being published. But instead the following message pops up:
And here is the content of the mentioned in the error message file:
2019-10-28 19:39:43
System.AggregateException: One or more errors occurred. ---> System.Exception: Publishing failed.
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.Publish.Framework.Model.DefaultPublishSteps.<>c__DisplayClass26_0.<IsBuildCompletedSuccessfully>b__2()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Publish.Framework.Model.DefaultPublishSteps.<DefaultCorePublishStep>d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Publish.Framework.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__202.MoveNext()
---> (Inner Exception #0) System.Exception: Publishing failed.<---
System.Exception: Publishing failed.
===================
The question is.. What am I doing wrong and/or how to fix the issue?
Important note:
If Deployment Mode is set to "Framework Dependent", and the Target Runtime is "linux-x64" then the project is published into the directory with no issues.
If Deployment Mode is set to "Self-contained", but Target Runtime is "win-x64", then deployment works with no issues.
The error is in the build output window:
There was no runtime pack for Microsoft.WindowsDesktop.App.WPF available for the specified RuntimeIdentifier 'linux-x64'
WPF is not supported on Linux, only Windows.

Failed to set up deployment to Azure Web App [AADSTS700027: Client assertion contains an invalid signature]

I'm having a problem setting up a deployment source on an Azure Web App.
Continuous deployment had been setup and was working fine for me before, but currently I can't set up a new deployment any more.
When I attempt to set the Deployment Source for my Web App in the portal: Deployment Center -> Azure Repos -> App Service build service -> choosing my Azure DevOps repo -> Continue -> Finish, it fails with the following error:
Repository 'UpdateSiteSourceControl' operation failed with Microsoft.Web.Hosting.WebHostingException: AADSTS700027: Client assertion contains an invalid signature. [Reason - The key was not found., Thumbprint of key used by client: '############################################']
Trace ID: 02f6d499-09a2-434d-a0cc-8964eca7e300
Correlation ID: cf1039fd-9244-4469-9a2e-740cfc206262
Timestamp: 2019-08-22 09:12:55Z
at Microsoft.Web.Hosting.Security.AADHelper.<HttpPost>d__42.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.Web.Hosting.Security.AADHelper.<GetVsoToken>d__36.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.Web.Hosting.Administration.VsoSiteRepositoryProvider.<GetAccessToken>d__16.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.Web.Hosting.Administration.VsoSiteRepositoryProvider.<GetAccountGitEndpoint>d__21.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.Web.Hosting.Administration.VsoSiteRepositoryProvider.<UpdateSiteSourceControl>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.Web.Hosting.Administration.WebCloudController.<>c__DisplayClass223_1.<<UpdateSiteSourceControl>b__1>d.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.Web.Hosting.AsyncHelper.RunSync[TResult](Func`1 func)
at Microsoft.Web.Hosting.Administration.WebCloudController.UpdateSiteSourceControl(String subscriptionName, String webspaceName, String name, SiteSourceControl siteSourceControl).
I tried deleting and recreating the Web App service, but that made no difference.
It was Microsoft issue. Already fixed

Do I need to install Node.js on Production Server to host Angular 2?

I am trying to deploy my 1st Angular 2 app on our live server (Windows 2008R2 IIS 7.5 server)
The MVC part is running fine. I could see the login username and showing the frame of MVC layout. But it's redirecting me to the Error.cshtml all the time.
I tried to turn on the DebugLog feature and I am getting the following error logs.
An unhandled exception has occurred: Failed to start Node process. To
resolve this:.
[1] Ensure that Node.js is installed and can be found in one of the
PATH directories.
Current PATH enviroment variable is: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
Files\Microsoft\Web Platform
Installer\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
Files\dotnet\;;C:\Program
Files\dotnet\shared\Microsoft.NETCore.App\1.1.1
Make sure the Node executable is in one of those directories, or update your PATH.
[2] See the InnerException for further details of the cause.
It's telling me to install Node.js on the Production Server. I can install it on the live server but I am not sure whether I am doing it right or not.
As far as I know, all type script files are compiled onto .js file by using webpack and why do we still need to install Node on the Production server again?
Detail Log file can be seen here
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://prenrolments/
info: Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationMiddleware[3]
HttpContext.User merged via AutomaticAuthentication from authenticationScheme: Cookie.
info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1]
Authorization was successful for user: ttcg.
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
Executing action method PREnrolments.Controllers.HomeController.Index (PREnrolments) with arguments ((null)) - ModelState is Valid
info: Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor[1]
Executing ViewResult, running view at path /Views/Home/Index.cshtml.
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
Executed action PREnrolments.Controllers.HomeController.Index (PREnrolments) in 3883.5488ms
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0]
An unhandled exception has occurred: Failed to start Node process. To resolve this:.
[1] Ensure that Node.js is installed and can be found in one of the PATH directories.
Current PATH enviroment variable is: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;;C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1
Make sure the Node executable is in one of those directories, or update your PATH.
[2] See the InnerException for further details of the cause.
System.InvalidOperationException: Failed to start Node process. To resolve this:.
[1] Ensure that Node.js is installed and can be found in one of the PATH directories.
Current PATH enviroment variable is: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;;C:\Program Files\dotnet\shared\Microsoft.NETCore.App\1.1.1
Make sure the Node executable is in one of those directories, or update your PATH.
[2] See the InnerException for further details of the cause. ---> System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.LaunchNodeProcess(ProcessStartInfo startInfo)
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.LaunchNodeProcess(ProcessStartInfo startInfo)
at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance..ctor(String entryPointScript, String projectPath, String[] watchFileExtensions, String commandLineArguments, ILogger nodeOutputLogger, IDictionary`2 environmentVars, Int32 invocationTimeoutMilliseconds, Boolean launchWithDebugging, Int32 debuggingPort)
at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance..ctor(NodeServicesOptions options, Int32 port)
at Microsoft.AspNetCore.NodeServices.HostingModels.NodeServicesOptionsExtensions.<>c__DisplayClass0_0.<UseHttpHosting>b__0()
at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.GetOrCreateCurrentNodeInstance()
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 Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper.<ProcessAsync>d__33.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.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>d__0.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 AspNetCore._Views_Home_Index_cshtml.<ExecuteAsync>d__35.MoveNext() in /Views/Home/Index.cshtml:line 2
--- 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.Razor.RazorView.<RenderPageAsync>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.Razor.RazorView.<RenderAsync>d__13.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.ViewFeatures.ViewExecutor.<ExecuteAsync>d__18.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.ViewResult.<ExecuteResultAsync>d__26.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.<InvokeResultAsync>d__30.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.<InvokeNextResultFilterAsync>d__28.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(ResultExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<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.ControllerActionInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__20.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.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.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.Diagnostics.ExceptionHandlerMiddleware.<Invoke>d__6.MoveNext()
info: Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationMiddleware[3]
HttpContext.User merged via AutomaticAuthentication from authenticationScheme: Cookie.
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
Executing action method PREnrolments.Controllers.HomeController.Error (PREnrolments) with arguments ((null)) - ModelState is Valid
info: Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor[1]
Executing ViewResult, running view at path /Views/Shared/Error.cshtml.
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
Executed action PREnrolments.Controllers.HomeController.Error (PREnrolments) in 724.6616ms
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 5619.0985ms 500 text/html; charset=utf-8
If you have created your application using "AspNetCoreSpaTemplates" in VS2017 then by default it would add "Microsoft.AspNEtCore.SpaServices" to your project, you should see this under NuGet package list (please refer to the attached screenshot).
This "Microsoft.AspNEtCore.SpaServices" package includes "Microsoft.AspNetCore.NodeServices" which has dependency for Node.js on the server.
https://learn.microsoft.com/en-us/aspnet/core/client-side/spa-services
Microsoft.AspNEtCore.SpaServices is used for server-side pre-rendering.
If you do not need this, you can uninstall Microsoft.AspNEtCore.SpaServices from Nuget Package Manager option.
After you uninstall it you should get 2 to 3 build errors as the SPA services is referred in "Startup.cs" & "ViewImports.cshtml". Comment or delete those reference and publish your code to server. Now it should work without Node.js on the server.

Resources