c# - 从 Angular 应用程序调用 C# 函数
问题描述
我有 C# 类连接到 RF 阅读器以创建酒店锁卡我需要从我的 Angular Web 应用程序运行这个 C# 函数有什么想法来执行这个吗?
这是 C# 类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace CSharpDemo
{
class Class1
{
[DllImport("LockSDK.dll", EntryPoint = "TP_Configuration")]
public static extern int TP_Configuration(Int16 LockType);
private static void IDD102_1002_Click()
{
//Set SDK
Int16 locktype = 0;
locktype = 5;
int st = TP_Configuration(locktype);
//CheckErr(st);
}
static void Main(string[] args)
{
IDD102_1002_Click();
}
}
我如何从 Angular Web 应用程序运行它
解决方案
您可以创建简单的 WebApi 并公开您尝试使用的方法。然后,你可以从你的 Angular 应用程序中点击 web api 来获得结果。
推荐阅读
- flutter - 错误:“num?”类型的值 不能分配给“num”类型的变量,因为“num?
- java - 使用 Mockito 在 java 测试类中模拟一个 kotlin 类
- css - 如何将未知宽度的 div 标签(包含文本)与另一个 div 标签下的右侧对齐
- node.js - NodeJS:Sequelize ORM 保存时出错,无法将 DTO 正确映射到实体
- python - PyLDAvis 错误:索引 11588 超出轴 1 的范围,大小为 11588
- python - 如何绘制 NxM 矩阵中列的平均值,python
- java - Netbeans 12 lts 版本未启动
- flutter - 从 Firebase 实时数据库中获取数据时,如何使扩展面板的“已扩展”功能单独工作?
- assembly - 以字符串形式输入,然后以汇编语言 8086 将其写入文件
- python - 如何使用带条件的地图功能?