简体   繁体   English

如何使 C#.Net web 服务在 IIS7 中永久存在?

[英]How to make C# .Net web service to be permanent in IIS7?

I have C#.Net web service, which should be connected to some local application.我有 C#.Net web 服务,应该连接到一些本地应用程序。 While it is connected, user can posting jobs to the local app using web methods of this service.连接后,用户可以使用此服务的 web 方法将作业发布到本地应用程序。 Once connection is established, it should last "forever" (until server restarts:)), because there are some callback functions given to the local app, and if service is not loaded into memory (or disconnected), local app can't make a call of callback function.一旦建立连接,它应该“永远”持续(直到服务器重新启动:)),因为本地应用程序有一些回调函数,如果服务没有加载到 memory (或断开连接),本地应用程序无法进行回调 function 的调用。

I do not know how IIS7 works, when it loads and when unloads dll of the service.我不知道 IIS7 是如何工作的,它何时加载以及何时卸载服务的 dll。 I need it not to unload service at all.我需要它根本不卸载服务。 How to do that?怎么做?

Thank you very much, Regards非常感谢,问候

I would suggest you write you web service in WCF, you can then host your service as windows service or as application, or even on normal IIS. I would suggest you write you web service in WCF, you can then host your service as windows service or as application, or even on normal IIS. WCF gives you a lot more control over you web service and how you host it. WCF 让您可以更好地控制 web 服务及其托管方式。

I have found solution - web service will be permanent, and so will be connection with local app, if I set application pool idle time on 0 (so IIS7 will never put it to "sleep", and unload dll of service).我找到了解决方案 - web 服务将是永久性的,因此将与本地应用程序连接,如果我将应用程序池空闲时间设置为 0(因此 IIS7 永远不会将其置于“睡眠”状态,并卸载服务的 dll)。

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

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