为什么Application_Start在卡西尼而不在IIS7中运行?

时间:2021-08-01 20:54:34

I have an ASP.NET 3.5 sp1 app that's in development in Cassini. The app includes a global.asax file that should run some code - it works fine in Cassini but in IIS the debugger never hits the function. Why doesn't that code run?

我有一个ASP。NET 3.5 sp1应用正在卡西尼开发中。该应用程序包含一个全局变量。asax文件应该运行一些代码——在Cassini中运行良好,但在IIS中,调试器从未达到功能。为什么代码不运行?

4 个解决方案

#1


2  

Maybe in Cassini, the Application is started when Cassini is launched. In II7, a service, the application is already started and when you launchh the debugger, VS attached only the debugger. You can try to launch the debugger and recycle the pool in the IIS console to see the application restarted ?

也许在卡西尼号上,当卡西尼号发射时,这个应用就开始了。在服务II7中,应用程序已经启动,当您启动调试器时,VS仅附加调试器。您可以尝试启动调试器并回收IIS控制台中的池,以查看应用程序重新启动吗?

#2


1  

You're manually attaching the debugger to the w3wp.exe process? Most likely you're simply too late and the Application_Start already ran by the time the debugger attaches.

您正在手动将调试器附加到w3wp。exe进程?很可能您已经太晚了,并且在调试器连接时,Application_Start已经运行了。

#3


1  

Are you sure that the code isn't being executed or could it be that you are simply attaching to the process too late for the debugger to be of any use for it? I'd suggest adding some logging to the method to be sure.

您确定代码没有被执行吗?或者您只是将代码附加到进程中已经太晚了,以至于调试器无法使用它?我建议在方法中添加一些日志记录。

#4


0  

I'm seeing the same issue with a WCF web project running in IIS7. The very first line of code in Application_Start() is a logger write, and I never get it. Also, other objects that are supposed to be initialized on Application_Start never get created and the rest of my code fails because of it. Anyone ever figure anything out with this? It does run fine in Cassini...

在IIS7中运行的WCF web项目也存在同样的问题。Application_Start()中的第一行代码是一个日志记录器的编写,我从来没有得到它。另外,应该在Application_Start上初始化的其他对象永远不会被创建,我的代码的其余部分也会因为它而失败。有人知道这个吗?它在卡西尼号上运行良好…

#1


2  

Maybe in Cassini, the Application is started when Cassini is launched. In II7, a service, the application is already started and when you launchh the debugger, VS attached only the debugger. You can try to launch the debugger and recycle the pool in the IIS console to see the application restarted ?

也许在卡西尼号上,当卡西尼号发射时,这个应用就开始了。在服务II7中,应用程序已经启动,当您启动调试器时,VS仅附加调试器。您可以尝试启动调试器并回收IIS控制台中的池,以查看应用程序重新启动吗?

#2


1  

You're manually attaching the debugger to the w3wp.exe process? Most likely you're simply too late and the Application_Start already ran by the time the debugger attaches.

您正在手动将调试器附加到w3wp。exe进程?很可能您已经太晚了,并且在调试器连接时,Application_Start已经运行了。

#3


1  

Are you sure that the code isn't being executed or could it be that you are simply attaching to the process too late for the debugger to be of any use for it? I'd suggest adding some logging to the method to be sure.

您确定代码没有被执行吗?或者您只是将代码附加到进程中已经太晚了,以至于调试器无法使用它?我建议在方法中添加一些日志记录。

#4


0  

I'm seeing the same issue with a WCF web project running in IIS7. The very first line of code in Application_Start() is a logger write, and I never get it. Also, other objects that are supposed to be initialized on Application_Start never get created and the rest of my code fails because of it. Anyone ever figure anything out with this? It does run fine in Cassini...

在IIS7中运行的WCF web项目也存在同样的问题。Application_Start()中的第一行代码是一个日志记录器的编写,我从来没有得到它。另外,应该在Application_Start上初始化的其他对象永远不会被创建,我的代码的其余部分也会因为它而失败。有人知道这个吗?它在卡西尼号上运行良好…