首页 > 解决方案 > 从 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 应用程序运行它

标签: c#angular

解决方案


您可以创建简单的 WebApi 并公开您尝试使用的方法。然后,你可以从你的 Angular 应用程序中点击 web api 来获得结果。


推荐阅读