webservice 中如何触发global.asax

bitshengwuyixue 2014-09-02 09:41:45
在webservice 中的service1.asmx写了一个程序,Hello World 程序,并添加了global.asax,在asp.net中调用这个服务中的Hello World(),然后想调用Hello World 的时候触发 global.asax中的application_start(),我应该怎么做,是不是在Hello World()中添加什么代码,asp.net 调用Hello World()的时候,直接触发application_start(),我应该怎么做,谢谢,有知道的吗?我是个新手,不大会阿,谢谢各位亲了
...全文
684 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
SPFarmer 2015-03-05
  • 打赏
  • 举报
回复
Application_Start是自动启动的,不需要你再调用。
xw852036 2015-03-04
  • 打赏
  • 举报
回复
程序启动时会自动的调用
  • 打赏
  • 举报
回复
Application_Start 翻译成中文就是 程序 启动 这部分代码不是给谁调用的,而是ASP.NET框架来调用的
虫二二 2014-12-19
  • 打赏
  • 举报
回复
Web Services do not use global.asax. Web services are not HttpApplications. They do not have Sessions. From the online help: The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for responding to application-level and session-level events raised by ASP.NET or by HTTP modules. The Global.asax file resides in the root directory of an ASP.NET application. At run time, Global.asax is parsed and compiled into a dynamically generated .NET Framework class derived from the HttpApplication base class. 参考链接: http://forums.asp.net/t/1358283.aspx?Global+asax+in+web+service+not+getting+fired
bitshengwuyixue 2014-09-02
  • 打赏
  • 举报
回复
怎么没人回阿
  • 打赏
  • 举报
回复
你的问题本身就有问题 MSDN查一下application_start是什么时候触发的
ojekleen 2014-09-02
  • 打赏
  • 举报
回复
Application_Start 方法 是在第一个用户访问时才被调用的,并且只会被调用一次。
源码 8 References . 8 2. Language Features 9 Oxygene Compiler. 9 Delphi Prism Projects and Namespaces 9 Methods ... 11 Unnamed Constructors ............................................................. 12 IDE: Build and Debug ............................................................... 12 Strings.................................................................................... 13 For-Loops ................................................................................ 15 Prism Loop .............................................................................. 16 Conditions ............................................................................... 17 Try except finally end ............................................................... 17 Exception Filters ...................................................................... 17 Variables ................................................................................. 18 Properties................................................................................ 18 .NET Specific Features ........................................................................ 19 Partial Classes ......................................................................... 19 Partial Methods ........................................................................ 21 Generics.................................................................................. 21 Generic Constraints .................................................................. 23 Generic Methods ...................................................................... 23 LINQ....................................................................................... 24 Sequences............................................................................... 25 Delphi Prism Specific Features ............................................................. 28 Async...................................................................................... 28 Futures ................................................................................... 28 Parallel.................................................................................... 29 Summary .......................................................................................... 29 References ........................................................................................ 30 3. Delphi Prism .NET Projects 31 WinForms.......................................................................................... 31 Toolbox and Design .................................................................. 34 Properties and Events ............................................................... 34 Windows Presentation Foundation ........................................................ 36 XAML ...................................................................................... 38 Silverlight................................................................................ 40 Mono ................................................................................................ 40 Summary .......................................................................................... 40 References ........................................................................................ 40 Delphi Prism Essentials Table of Contents Bob Swart Training & Consultancy - iii - www.drbob42.com 4. dbExpress and DataSnap 41 dBExpress ......................................................................................... 41 Server Explorer........................................................................ 41 Data Sources ........................................................................... 44 DataSnap Clients................................................................................ 53 DataSnap Server...................................................................... 53 Delphi Prism Server Explorer ..................................................... 55 Delphi Prism DataSnap 2010 Clients........................................... 58 Summary .......................................................................................... 62 References ........................................................................................ 62 5. ASP.NET Web Applications 63 ASP.NET Web Sites............................................................................. 63 .aspx ...................................................................................... 64 .aspx.pas ................................................................................ 65 Debug | Start without Debugging............................................... 66 Web.config .............................................................................. 66 appSettings ............................................................................. 67 Custom Errors.......................................................................... 67 Authorization ........................................................................... 68 compilation.............................................................................. 71 Global.asax.............................................................................. 71 Application and Session State.................................................... 71 Session State........................................................................... 71 Application State...................................................................... 73 More Session Support ............................................................... 73 Navigation ............................................................................... 74 Master Page............................................................................. 75 Menu ...................................................................................... 76 Web Site Deployment ............................................................... 79 ASP.NET and Data Access ................................................................... 80 ASP.NET Project ....................................................................... 80 Declaritve Data Sources............................................................ 80 Project Deployment .................................................................. 93 Summary .......................................................................................... 94 6. ASP.NET Web Services 95 ASP.NET Web Service as Web Site ....................................................... 95 [WebService]........................................................................... 96 [WebMethod]........................................................................... 97 WebMethod properties .............................................................. 98 EnableSession.......................................................................... 98 First Test................................................................................. 98 ASP.NET Test........................................................................... 100 Deployment............................................................................. 101 WSDL ..................................................................................... 102 Web Service Client ................................................................... 103 Asynchronous Calls .................................................................. 105 Web Service Projects .......................................................................... 107 EnableSession.......................................................................... 109 Web Service Client ................................................................... 111 Using Web Services .................................................................. 113 Session Cleanup....................................................................... 114 Deployment............................................................................. 115 Amend Client URL .................................................................... 116 Security: SOAP Headers...................................................................... 117 SOAP Header Client .................................................................. 119 Delphi Prism Essentials Table of Contents Bob Swart (Bob@eBob42.com) - iv - June 2011 HttpHandler....................................................................................... 122 IHttpHandler............................................................................ 122 Custom HttpHandlers................................................................ 122 Num to Word ........................................................................... 126 Returning XML Files .................................................................. 129 Windows Communication Foundation.................................................... 129 WCF........................................................................................ 129 WCF Demo .............................................................................. 130 WCF Service ............................................................................ 131 Contracts ................................................................................ 131 IMoneyService ......................................................................... 132 WCF Host ................................................................................ 133 Hosting in IIS .......................................................................... 133 Deployment............................................................................. 136 Delphi Prism WCF Client............................................................ 137 Summary .......................................................................................... 139 References ........................................................................................ 139 7. Delphi Prism XE and MonoTouch 141 Mac OS X Development....................................................................... 141 iPhone SDK ............................................................................. 141 Mono for OS X ......................................................................... 142 Delphi Prism XE and MonoTouch ................................................ 142 MonoTouch SDK....................................................................... 142 Updated Templates for MonoTouch and MonoMac......................... 142 Deployment............................................................................. 143 Delphi Prism XE in MonoDevelop .......................................................... 143 First Demo: Get Time ............................................................... 144 Outlets.................................................................................... 149 Actions.................................................................................... 152 Second Demo: Hello, World!...................................................... 157 Third Demo: Tic-Tac-Toe........................................................... 162 Fourth Demo: Database ............................................................ 169 Summary: MonoTouch Clients ............................................................. 174 8. Hydra: Win32 and .NET 175 Hydra ............................................................................................... 175 Delphi Prism Hydra .NET Plugin Module ...................................... 175 Hydra Win32 Server ................................................................. 178 Loading and Using.................................................................... 180 Closure ................................................................................... 183 Delphi 2010 Hydra Win32 Plugin................................................ 184 Delphi Prism Hydra .NET Server................................................. 184 Summary .......................................................................................... 184

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧