如何使用ASMX Web服务从运行Windows服务返回字段?

时间:2022-10-30 23:28:17

I've some static Engine class running in windows service, and I want to return Engine's some fields using web service.(simple ASP.NET web service)

我在Windows服务中运行了一些静态Engine类,我想使用Web服务返回Engine的一些字段。(简单的ASP.NET Web服务)

How can I do this?

我怎样才能做到这一点?

when I simply write in my web service:

当我只是写我的网络服务时:

return Engine.SomeField;

It creates new instance of Engine end works with that, which is different from Engine running in windows service, even if it's marked as static.

它创建了Engine的最终实例,它与在Windows服务中运行的引擎不同,即使它被标记为静态。

1 个解决方案

#1


1  

You cannot use an ASMX web service (aka ASP.NET web service) inside of a Windows Service. Only WCF has the ability to be hosted inside of anything other than IIS.

您不能在Windows服务中使用ASMX Web服务(也称为ASP.NET Web服务)。只有WCF才能在IIS以外的任何内容中托管。

#1


1  

You cannot use an ASMX web service (aka ASP.NET web service) inside of a Windows Service. Only WCF has the ability to be hosted inside of anything other than IIS.

您不能在Windows服务中使用ASMX Web服务(也称为ASP.NET Web服务)。只有WCF才能在IIS以外的任何内容中托管。