Silverlight-服务器端初始化 [英] Silverlight - serverside initialization
问题描述
我是SilverLight和Web开发的新手.当Silverlight应用程序的Web服务器应用程序启动时,我要启动一些进程(服务器端)..我该怎么做..没有Main()或我可以看到的其他任何方式.
我觉得这与当前指向.XAP文件的启动页面上的html标记有关.如果我想在服务器应用程序启动时实例化名为Startup的类,该如何做.我希望这是清楚的.它等效于控制台应用程序:
void Main()
{
启动s =新的Startup()
}
I am new to SilverLight and also web development. When the webserver application for the Silverlight app starts up I want to kick off some processes (server side) .. how do I do this .. there is no Main() or any other way I can see of doing this.
I have a feeling it is to do with the html tag on the startup page which currently point to a .XAP file. If I want to instantiate a class called Startup when the server app begins .. how do I do this. I hope this is clear. It is the equivalent of a console app :
void Main()
{
Startup s = new Startup()
}
推荐答案
看看App.xaml
类内部的Application_Startup
方法.此方法将为您提供修改启动类的便利.
如果您从头开始创建了一个简单的SL项目,您将看到new Page()
行.可以根据您的需要进行修改.
Have a look at theApplication_Startup
method inside theApp.xaml
class. This method will give you the facility to modify your startup class.
If you have created a simple SL project from scratch you shall see thenew Page()
line. This can be modified as per your needs.
App.xaml类中的Application_Startup方法位于SilverLight端. 但是我认为答案是服务器端Global.asax中的Application_Start.
Application_Startup method inside the App.xaml class is on the SilverLight side.
But I think the answer is Application_Start in Global.asax on the server side.
这篇关于Silverlight-服务器端初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!