Web部署项目global.asax问题 [英] Web Deployment Projects global.asax problem

查看:85
本文介绍了Web部署项目global.asax问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用新的Web部署项目编译的Web项目。插件

for VS2005。

我正在将web项目部署到一个程序集,并且可更新选项设置为

到ON。

当我在W2K3服务器上运行生成的代码时,application_start

和global.asax文件上的任何其他事件都不会激活。我添加了跟踪和

日志记录以确保并且我可以看到代码只是没有执行。当

在XP专业版机器上运行相同的(部署等)代码时,所有内容都是

正常运行且事件正在触发。

如果我在W2K3机器上测试原始项目(非编译源.vb文件和

所有东西),它也可以正常工作。所以好像是在b + b
的东西正在改变影响W2K3服务器的编译

而不是XP平台。


请帮忙。


谢谢,

Ron

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,
Ron

推荐答案

你好罗恩,


感谢您在此发帖。


从您的描述中,我了解到您正在使用vs 2005 web

部署项目,用于预编译和部署ASP.NET 2.0 Web

应用程序。但是,你发现在一个目标windows 2003服务器上,

应用程序的global.asax代码永远不会执行,对吗?


基于我的经验,问题可能是由global.asax引起的。
组件类永远不会在该问题服务器上加载(和使用)。

当我们使用webdeployment项目进行预编译时Web应用程序(和/ b $ b正常项目设置配置为可更新),输出预编译的

应用程序将不会复制global.asax。文件到目标

应用程序的目录。您可以在appilcation已部署的

目录中验证这一点,以查看global.asax文件是否存在。

此外,您可以在页面中使用以下代码验证

应用程序是否已加载global.asax class as Application Intstance

class:


==========

protected void Page_Load(object发件人,EventArgs e)

{

Response.Write("< br /> ApplicationInstance:" +

Context.ApplicationInstance .GetType()。FullName);

}

==========

它会输出如下内容:


" ApplicationInstance:ASP.global_asax"如果加载了global.asax,


如果没有加载global.asax,它将输出


ApplicationInstance:System .Web.HttpApplication"


我假设它会输出后者。如果是这样,您可以检查该global.asax组件的预编译的

程序集。通常,global.asax类

将被编译到主预编译程序集中(如果使用

webdeployment项目并选择单输出程序集)。并且在

私人bin中dir,你可以找到一些* .compiled文件。这些文件

用于将基于原始文件的资源(例如代码,页面...)映射到预编译的程序集。对于global.asax,您应该能够找到名为App_global.asax.compiled的

a文件,此类将包含

有关哪个程序集是" global.asax中"等级。

文件的内容如下:


============= App_global.asax。编译==========


< preserve resultType =" 8" virtualPath =" /IISTestSite/global.asax"

hash =" 79af1631" filehash = QUOT; 2eea5b7b48d6" flags =" 150000"

assembly =" IISTestSite_deploy" type =" ASP.global_asax">

< filedeps>

< filedep name =" /IISTestSite/global.asax" />

< / filedeps>

< / preserve>

============= =


告诉运行时,它在寻找global.asax时该文件为

该类,它应该更改为在

" IISTestSite_deploy.dll中找到该类。汇编。


因此,如果您没有找到此文件或此文件的内容已损坏,那么

ASP.NET应用程序将错误加载正确的global.asax类。


希望这会有所帮助。如果您对此有任何不清楚或者是否有任何我没想到的其他东西,请随时在此处发布。


问候,


Steven Cheng

Microsoft MSDN在线支持主管

============== ====================================


回复时发帖,请回复群组通过您的新闻阅读器

,其他人可以从您的问题中学习并从中受益。


================ ==================================

此帖子提供按现状 ;没有保证,也没有赋予任何权利。


安全! www.microsoft.com/security

(此帖子按原样提供,不作任何保证,并且不授予

权利。)
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.)


Hi Steven,


感谢您的信息。我仍有问题。

global.asax文件未复制到目标目录。复制它

手动无法解决问题。

我检查了App_global.asax.compiled文件,看起来很好,并指向正确的组件




再次,我想强调部署的Web应用程序工作

完美适用于XP Pro系统。将同一组文件复制到2003

服务器会给我们上一条消息中提到的错误。


还有什么我们可以检查吗?如果在XP机器或目标2003服务器上完成

编译会有区别吗?


谢谢,

Ron

Steven Cheng [MSFT]" < ST ***** @ online.microsoft.com>在消息中写道

news:gn ************** @ TK2MSFTNGXA01.phx.gbl ...
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]" <st*****@online.microsoft.com> wrote in message
news:gn**************@TK2MSFTNGXA01.phx.gbl...
Hello Ron,

感谢您在此发帖。

从您的描述中,我了解到您正在使用vs 2005 web
部署项目来预编译和部署ASP.NET 2.0 Web
应用程序。但是,你发现在一个目标windows 2003服务器上,
应用程序的global.asax代码永远不会执行,对吗?

根据我的经验,问题可能是由从不在该问题服务器机器上加载(和使用)global.asax
组件类。
当我们使用webdeployment项目预编译Web应用程序时(和/或正常项目设置配置为可更新的,输出预编译的应用程序将不会复制global.asax。将文件发送到目标
应用程序的目录。您可以在appilcation的
部署目录中验证这一点,以查看global.asax文件是否存在。
此外,您可以使用页面中的以下代码来验证
应用程序是否存在加载了global.asax class as the application
Intstance class:

==========
protected void Page_Load(object sender,EventArgs e)
{
Response.Write("< br /> ApplicationInstance:" +
Context.ApplicationInstance.GetType()。FullName);
}
======= ===

它会出现类似的东西:

ApplicationInstance:ASP.global_asax如果加载了global.asax,

如果没有加载global.asax,它将输出

ApplicationInstance:System.Web.HttpApplication<
>
我认为它会输出后者。如果是这样,您可以检查该global.asax组件的预编译组件。通常,global.asax
类将被编译到主预编译程序集中(如果使用webdeployment项目并选择单输出程序集)。并且在
私人垃圾箱中dir,你可以找到一些* .compiled文件。这些文件用于将基于原始文件的资源(例如代码,页面...)
映射到其预编译的程序集。对于global.asax,您应该能够找到名为App_global.asax.compiled的文件,该类将包含有关哪个程序集是global.asax的信息。该课程的内容如下:

============= App_global.asax.compiled ======= ===

< preserve resultType =" 8" virtualPath =" /IISTestSite/global.asax"
hash =" 79af1631" filehash = QUOT; 2eea5b7b48d6" flags =" 150000"
assembly =" IISTestSite_deploy" type =" ASP.global_asax">
< filedeps>
< filedep name =" /IISTestSite/global.asax" />
< / filedeps>
< / preserve>
==============

这告诉了运行时,当它正在寻找global.asax时对于该类的文件,它应该更改为在IISTestSite_deploy.dll中找到该类。如果你没有找到这个文件或者这个文件的内容已经损坏,那么ASP.NET应用程序将会错误地加载正确的global.asax类。

希望这会有所帮助。如果您对此有任何不清楚或有任何其他我没有得到的东西,请随时在此发布。

问候,
Steven Cheng
Microsoft MSDN在线支持主管

============================== ====================

在回复帖子时,请回复群组通过您的新闻阅读器,以便其他人可以从您的问题中学习并从中受益。

======================== ==========================

此帖子按原样提供。没有保证,也没有
的权利。

安全! www.microsoft.com/security
(此帖已提供按原样,没有保证,也没有赋予
权利。)
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,


您是否尝试过Steven建议的代码:


==========

protected void Page_Load(object sender ,EventArgs e)

{

Response.Write("< br /> ApplicationInstance:" +

Context.ApplicationInstance。 GetType()。FullName);

}

==========


而且,什么是您在服务器上得到的结果?


问候,


Luke Zhang

Microsoft在线社区负责人/>

======================================== ==========

在回复帖子时,请回复群组通过你的新闻阅读器

其他人可以从你的问题中学习并从中受益。

==================== ==============================


(此帖子提供AS IS,没有任何保证,也没有赋予

权利。)

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.)


这篇关于Web部署项目global.asax问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆