Session_start not firing in production server

A

Alex

Hello All,

I'm having a problem with global.asax file. The session_start method of
globals.asax.vb is not firing in my project when I copy the files to a
production server. It works OK in my development machine, which has VS2005
on Windows XP SP2.
The production server is a Windows 2000 Server SP4. (Almost a fresh install,
only with .NET FWK 2.0).
I configured a new site in IIS5. Then I compiled the application in the
development machine and copied ALL the files (including the /bin folder) to
the server.

I've checked the global.asax file by putting a breakpoint in the
session_start method and it get hit while debugging (always in MY comp).

Then I removed all the code for testing purposes and left only this:
Sub Session_Start(ByVal sender as object, ByVal e as EventArgs)
Throw New Exception("HEEEELLLOOOOOOO")
End Sub

The server doesn't stop at the exception, so no code is being called. (I
didn't use Diagnostics.EventLog since I had security permissions to
configure and this was a bit quicker to test)

My question is, are there any changes that need to be made in order for this
to work?
I tried these already:
. Changing the compile options of the global.asax (the default is
"Content", and I used "Embedded resource", then changed it back since it
didn't solve my problem).
. Restarting IIS after running
"%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i"


Any suggestions are welcome.
Thanks
__________________
Alejandro

+ Info: The development machine has also "Microsoft visual studio 2005 Web
Application Projects" installed.
 
G

Guest

I've checked the global.asax file by putting a breakpoint in the
session_start method and it get hit while debugging (always in MY comp).


Sorry didn't get it, how do you debug remote server?
 
A

Alex

No no... I didn't debug the remote server... I debug in my development
computer. I did that just to be sure that the method was being called (at
least locally).

Now, I found something weird... if I move the Session_Start code from
global.asax.vb to Global.asax, enclosing it with the <script> tags like
this:
<script runat="server">
Sub Session_Start (....
....
End Sub
</script>

Then the method IS called. I don't know why this is behaving like the old
ASP way. Why does global.asax have a code behind file if it not being used?
 
G

George Ter-Saakov

In order Global.asax to work you must create an application.
In IIS Managment console right click on your folder and you will see
"Create" next to "Application Name"

On your develoment machine VS does it automaticly when you creating project

George.
 
A

Alex

Thanks for the tip, but I forgot to mention that I already made an
application in IIS, so that's not the source of the problem... =(
 
A

Alex

No, I created a Web Application Project. Besides, the strange thing is that
the same files work perfect in my development computer, but not in the
server.
That's the reason I think there might be something regarding IIS which
doesn't work with my app in the server.
Thanks for the tip anyway
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top