Thursday, March 22, 2012

Web Deployment Projects global.asax problem

I have a web project compiled with the new "Web Deployment Projects" plugin
for VS2005.
I'm deploying the web project to one assembly and with updateable option set
to ON.
When I'm running the generated code on a W2K3 server the application_start
and any other event on the global.asax file won't fire. I added tracing and
logging to make sure and I can see the code is just not execution. When
running the same exact (deployed etc.) code on an XP Pro machine everything
just works and the events are firing.
If I test the original project (non compiled with source .vb files and
everything) on the W2K3 machine, it also works fine. So it seems to be
something that is changing in the compilation that affects the W2K3 server
but not the XP platform.
Please help.
Thanks,
RonHello Ron,
Thank you for posting here.
From your description, I understand that you're using the vs 2005 web
deployment project to precompile and deploy your ASP.NET 2.0 Web
application. However, you found that on one target windows 2003 server, the
application's global.asax code never get executed, correct?
Based on my experience, the problem is likely caused by the global.asax
component class is never loaded (and used) on that problem server machine.
When we use webdeployment project to precompile the web application( and
normal project setting configured as "updatable"), the output precompiled
application will not copy the "global.asax" file to the target
application's directory. You can verify this in your appilcation's deployed
directory to see whether the global.asax file is there.
Also, you can use the following code in page to verify whether the
application has loaded the "global.asax" class as the Application Intstance
class:
==========
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("<br/>ApplicationInstance: " +
Context.ApplicationInstance.GetType().FullName);
}
==========
It wil out put something like:
"ApplicationInstance: ASP.global_asax" if the global.asax is loaded,
else if the global.asax is not loaded, it will output
"ApplicationInstance: System.Web.HttpApplication"
I assume it will output the latter. If so, you can check the precompiled
assemblies of that global.asax component. Generally , the global.asax class
will be compiled into the main precompiled assembly(if you use
webdeployment project and choose single output assembly). And in the
private "bin" dir, you can find some "* .compiled" files. These files
are used to map the original file based resource(such as code, page ...) to
their precompiled assemblies. For global.asax, you should be able to find
a file named "App_global.asax.compiled", this class will contains the
information about in which assembly is the "global.asax" class located.
The file's content is as below:
=============App_global.asax.compiled==========
<preserve resultType="8" virtualPath="/IISTestSite/global.asax"
hash="79af1631" filehash="2eea5b7b48d6" flags="150000"
assembly="IISTestSite_deploy" type="ASP.global_asax">
<filedeps>
<filedep name="/IISTestSite/global.asax" />
</filedeps>
</preserve>
==============
this tell the runtime , when it is looking for the "global.asax" file for
the class, it should change to find the class in the
"IISTestSite_deploy.dll" assembly.
So if you didn't find this file or this file's content is corrupted, the
ASP.NET application will faild to load the correct global.asax class.
Hope this helps. If you have anything unclear on this or if there is any
other things I didn't quite get, please feel free to post here.
Regards,
Steven Cheng
Microsoft MSDN Online Support Lead
========================================
==========
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
==========
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Hi Steven,
Thanks for the info. I still have a problem.
The global.asax file is not copied to the target directory. Copying it
manually did not solve the problem.
I checked the "App_global.asax.compiled" file and it looked good and pointed
to the right assembly.
Again I would like to stress that the deployed web application works
perfectly on an XP Pro system. Copying the same set of files to the 2003
server gives us the errors I mentioned on the previous message.
Is there anything else we can check? Should there be a difference if the
compilation is done on an XP machine or on the target 2003 server?
Thanks,
Ron
"Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
news:gn3oz2QkGHA.5184@.TK2MSFTNGXA01.phx.gbl...
> Hello Ron,
> Thank you for posting here.
> From your description, I understand that you're using the vs 2005 web
> deployment project to precompile and deploy your ASP.NET 2.0 Web
> application. However, you found that on one target windows 2003 server,
the
> application's global.asax code never get executed, correct?
> Based on my experience, the problem is likely caused by the global.asax
> component class is never loaded (and used) on that problem server machine.
> When we use webdeployment project to precompile the web application( and
> normal project setting configured as "updatable"), the output precompiled
> application will not copy the "global.asax" file to the target
> application's directory. You can verify this in your appilcation's
deployed
> directory to see whether the global.asax file is there.
> Also, you can use the following code in page to verify whether the
> application has loaded the "global.asax" class as the Application
Intstance
> class:
> ==========
> protected void Page_Load(object sender, EventArgs e)
> {
> Response.Write("<br/>ApplicationInstance: " +
> Context.ApplicationInstance.GetType().FullName);
> }
> ==========
>
> It wil out put something like:
> "ApplicationInstance: ASP.global_asax" if the global.asax is loaded,
> else if the global.asax is not loaded, it will output
> "ApplicationInstance: System.Web.HttpApplication"
> I assume it will output the latter. If so, you can check the precompiled
> assemblies of that global.asax component. Generally , the global.asax
class
> will be compiled into the main precompiled assembly(if you use
> webdeployment project and choose single output assembly). And in the
> private "bin" dir, you can find some "* .compiled" files. These files
> are used to map the original file based resource(such as code, page ...)
to
> their precompiled assemblies. For global.asax, you should be able to find
> a file named "App_global.asax.compiled", this class will contains the
> information about in which assembly is the "global.asax" class located.
> The file's content is as below:
> =============App_global.asax.compiled==========
> <preserve resultType="8" virtualPath="/IISTestSite/global.asax"
> hash="79af1631" filehash="2eea5b7b48d6" flags="150000"
> assembly="IISTestSite_deploy" type="ASP.global_asax">
> <filedeps>
> <filedep name="/IISTestSite/global.asax" />
> </filedeps>
> </preserve>
> ==============
> this tell the runtime , when it is looking for the "global.asax" file for
> the class, it should change to find the class in the
> "IISTestSite_deploy.dll" assembly.
> So if you didn't find this file or this file's content is corrupted, the
> ASP.NET application will faild to load the correct global.asax class.
> Hope this helps. If you have anything unclear on this or if there is any
> other things I didn't quite get, please feel free to post here.
> Regards,
> Steven Cheng
> Microsoft MSDN Online Support Lead
>
> ========================================
==========
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
==========
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
Hello Ron,
Have you tried the code Steven suggested:
==========
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("<br/>ApplicationInstance: " +
Context.ApplicationInstance.GetType().FullName);
}
==========
And, what is the result you got on the server?
Regards,
Luke Zhang
Microsoft Online Community Lead
========================================
==========
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
==========
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
OK. I added the line
protected void Page_Load(object sender, EventArgs e)
> {
> Response.Write("<br/>ApplicationInstance: " +
> Context.ApplicationInstance.GetType().FullName);
> }
when using the "Web Deployment Projects" plugin with "updateable" output on
Server 2003
I get: "ApplicationInstance: System.Web.HttpApplication"
When using the original project tree (with source .vb file and all) on
Server 2003
I get: "ApplicationInstance: ASP.global_asax"
As said before on XP Pro all versions run correctly. the problem only shows
on Server 2003
Thanks,
Ron
"Luke Zhang [MSFT]" <lukezhan@.online.microsoft.com> wrote in message
news:KdJ7s21kGHA.4864@.TK2MSFTNGXA01.phx.gbl...
> Hello Ron,
> Have you tried the code Steven suggested:
> ==========
> protected void Page_Load(object sender, EventArgs e)
> {
> Response.Write("<br/>ApplicationInstance: " +
> Context.ApplicationInstance.GetType().FullName);
> }
> ==========
> And, what is the result you got on the server?
> Regards,
> Luke Zhang
> Microsoft Online Community Lead
> ========================================
==========
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
==========
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
Hi, I have the same problem.
I found this on a forum: http://forums.asp.net/thread/1253331.aspx
"Changing the name of the Application_Start method to Application_OnStart
fixed it for me."
any sense to that?
Also, after I add a virtual dircetory containing the vb files (not the
deploy version), and run it in IE, it runs well. Then, after that one "run",
if I try to ruin the deploy/merged version again, it works. It seems that
one good "run" loads that global or what ever the problematic file to memory
and it will work from now on.
My problem now is that I cannot find how to take it back to not working,
without ghosting the computer. Restarting IIS did not help (it still works).
After ghosting however, again it will not work.
"Luke Zhang [MSFT]" <lukezhan@.online.microsoft.com> wrote in message
news:KdJ7s21kGHA.4864@.TK2MSFTNGXA01.phx.gbl...
> Hello Ron,
> Have you tried the code Steven suggested:
> ==========
> protected void Page_Load(object sender, EventArgs e)
> {
> Response.Write("<br/>ApplicationInstance: " +
> Context.ApplicationInstance.GetType().FullName);
> }
> ==========
> And, what is the result you got on the server?
> Regards,
> Luke Zhang
> Microsoft Online Community Lead
> ========================================
==========
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
==========
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
Hello Ron,
Since the deployment project works well on the Windows XP computer, it make
us believe this is nothing with the deployment project. It is more like a
computer specified problem. (The difference between XP and 2003 won't make
such a problem). I suggest you try re-register ASP.NET 2.0 to see if it can
help, for example, First run following commands in VS 2005 Command Prompt
window:
aspnet_regiis -ua
to remove ASP.NET and then run:
aspnet_regiis -i
and reset IIS.
Will this help on the issue?
Luke Zhang
Microsoft Online Community Lead
========================================
==========
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
==========
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Hello,
After you run the VB version, you may execute the command "iisreset" in a
command prompt windows and then test the deploy version again, will it also
work?
Also, did you test with only one partcular project or you have test
multiple projects? Is it possible for you to send me the project so that I
can test it on my side? In my test, it always worked on a windows 2003
server. (You may check the deploy version virtual folder's properties, in
IIS manager, Is it use same .NET framework versio?)
Thanks,
Luke Zhang
Microsoft Online Community Lead
========================================
==========
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
==========
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

0 comments:

Post a Comment