简体   繁体   English

如何在ASP.NET Core(使用JavascriptService)应用程序中使Node.js代码调用csharp代码?

[英]How to make nodejs code call csharp code in asp.net core (with JavascriptService) application?

I'm using asp.net core for a simple web api server (with deepstream, actually). 我正在将asp.net内核用于简单的Web api服务器(实际上是使用Deepstream)。 While c# can call nodejs code flawlessly with NodeServices.InvokeExportAsync, when I try to pass Action/Func as parameter of NodeServices.InvokeExportAsync to nodejs, I get 虽然c#可以使用NodeServices.InvokeExportAsync完美地调用nodejs代码,但是当我尝试将Action / Func作为NodeServices.InvokeExportAsync的参数传递给nodejs时,却得到了

System.AggregateException: 'One or more errors occurred. (Serializing delegates is not supported on this platform.)'

The error is quite self-explanatory, just wondering is there anyway to get around this? 该错误是不言自明的,只是想知道是否仍然可以解决此问题? Maybe not passing delegate to nodejs, but through some other mechanism, to make calls from nodejs to csharp? 也许不将委托传递给nodejs,而是通过其他某种机制来进行从nodejs到csharp的调用?

Thanks 谢谢

For callback functions from JS files. 用于来自JS文件的回调函数。 Use nodeServices.InvokeAsync 使用nodeServices.InvokeAsync

This link gives more info. 链接提供了更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ASP.Net Core 2 如何在身份验证后触发/调用代码 - ASP.Net Core 2 how to trigger/call code after authentication ASP.NET Core 中的应用程序启动代码 - Application startup code in ASP.NET Core asp.net 核心 3.1 web 应用程序中未显示的代码参考 - References of code not showing in asp.net core 3.1 web application 使用 Visual Studio 代码创建 Asp.net MVC 应用程序(非核心) - Create Asp.net MVC Application (not core) with visual studio code EF Code First迁移替代ASP.NET Core应用程序 - EF Code First migrations alternative for ASP.NET Core application 在 ASP.Net Core 应用程序启动期间运行异步代码 - Run async code during startup in a ASP.Net Core application 如何将 ASP.NET Core 3.1 中 Startup.cs 中的代码移动到 ASP.NET Core 6? - How to move code in Startup.cs in ASP.NET Core 3.1 to ASP.NET Core 6? 如何使用 ASP.NET 内核制作 Razor 页面和 C# 代码框架? - How to do you make both a Razor Page and C# code framework with ASP.NET Core? 如何在ASP.NET application_start中调用一些异步代码 - How to call some async code in an ASP.NET application_start 如何在Mac上使用Vs代码部署ASP.NET Core MVC? - How to Deploy ASP.NET Core MVC with Vs Code on a Mac?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM