简体   繁体   English

如何从 windows 服务与 ABP API 通话

[英]How to talk with ABP API from windows service

This is what I would like to build.这就是我想要构建的。 A hosted web/api project built on APB where tenants can use the web application to define "Scan Definitions" that run inside their.network.一个基于 APB 构建的托管 web/api 项目,租户可以在其中使用 web 应用程序来定义在他们的网络中运行的“扫描定义”。 A scan definition would just contain a target IP Address to be scanned with WMI.扫描定义只包含要使用 WMI 扫描的目标 IP 地址。 They would download and install a windows service that would run periodically in their.network.他们会下载并安装一个 windows 服务,该服务会在他们的网络中定期运行。 The service would communicate with the APB web API to retrieve scan definitions, then run the scan and upload the resulting scan data into the APB web API. Then the users would be able to view that scan data within the web app.该服务将与 APB web API 通信以检索扫描定义,然后运行扫描并将生成的扫描数据上传到 APB web API。然后用户将能够在 web 应用程序中查看扫描数据。

My question is with the CORS access in place, how can I make it so that the windows service is allowed to talk with the API. Also what is the best way to authenticate the service with api such that the service would know which tenant it should be using so that it pulls down the correct scan definitions and uploads the data to the correct tenant as well.我的问题是 CORS 访问到位,我怎样才能使 windows 服务被允许与 API 通信。另外,使用 api 验证服务的最佳方法是什么,这样服务就会知道它应该与哪个租户联系正在使用,以便它提取正确的扫描定义并将数据上传到正确的租户。

Thanks in advance for any help or guidance.在此先感谢您的帮助或指导。

I was able to get a service up and running by following the abp sample found here: https://github.com/as.netboilerplate/as.netboilerplate-samples/tree/master/ConsoleRemoteWebApiCall/CallApiFromConsole我能够按照此处找到的 abp 示例启动并运行服务: https://github.com/as.netboilerplate/as.netboilerplate-samples/tree/master/ConsoleRemoteWebApiCall/CallApiFromConsole

I still have things to work through, but it's gotten me to a spot where I can access the api from a console application我还有一些事情要解决,但它让我可以从控制台应用程序访问 api

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM