WCF服务启动 [英] WCF Service Start

查看:366
本文介绍了WCF服务启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WCF服务,我想自动调用的方法,在IIS中发布之后。像WCF服务的,而无需手动或从其他地方调用该方法的初始化。我应该在哪里放置在WCF服务我的初始化方法,以便应用程序开始后究竟跑?

I have a wcf service and i want to call a method automatically , immediately after the publishing in IIS. Like an initialization of the WCF service without having to call the method manually or from somewhere else. Where should i place my Initialize method in WCF Service in order to run exactly after the start of the application?

推荐答案

如果你在IIS托管,您可以在的Global.asax 使用的Application_Start 事件Web应用程序,举办WCF服务做任何应用程序初始化。如果您正试图在首次安装时打电话给你的服务之一,那么这很可能是错误的做法。

If you're hosting in IIS you can use the application_start event within the Global.asax of the web app that hosting tHE WCF service to do any application initialization. If you are trying to call one of your services when it is first installed then this is likely the wrong approach.

什么是其上运行的Web服务的启动了一些code中的动机是什么?如果你想避开WCF服务,我建议你想要做的WCF客户端的一些工作,而不是在服务一个缓慢的初始呼叫......但我只是在你的动机猜测此处

What is the motivation for running some code on start up of the web service? If you are trying to get around a slow initial call to the WCF service I suggest you would want to do some work on the WCF client-side rather than in the service...but Im just guessing at your motivation here

这篇关于WCF服务启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆