global.asax 在本地计算机上工作,但在我发布到服务器后不起作用
如何将我的 global.asax
文件发布到我们的 ftp 站点?
我已将一个 global.asax
文件添加到我的项目中(使用 asp.net 和 vs2010 中的 c#),该文件在我的本地计算机上运行良好。然后当我发布到我们的 ftp 站点时。然后从 ftp 文件夹复制到站点文件夹并覆盖旧文件。这不起作用。我使用的是 Windows Server 2008 R2 企业版。
How can I get my global.asax
file to publish to our ftp site?
I have added a global.asax
file to my project (using asp.net with c# from vs2010) which works great on my local machine. Then when I publish to our ftp site. Then copy from the ftp folder into the site folder overwriting old files. It doesn't work. I am using Windows Server 2008 R2 Enterprise.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我们必须在发布配置文件中取消选中“发布期间预编译”功能,这样就成功了。
We had to uncheck the Precompile during publishing feature in our publishing profile and that did the trick.
检查 Global.asax 文件的“构建操作”是否在文件属性中设置为“内容”。将部署设置为内容的所有文件。
Check that the "Build action" of the Global.asax file is set to "Content" in the file properties. All files set to content will be deployed.
我遇到了同样的问题,发现我还必须将“复制到输出目录”属性设置为“始终复制”
I had the same problem and found that I also had to set
Copy to Output Directory
property toCopy always
我们尝试了很多事情。
我们还尝试将以下文件放入
root
和bin
目录中。都不起作用!
为了为我们的 asp .net 2.0 网站触发全局事件,我们必须使用原始的 Global.asax 而不是预编译的 dll。
希望这对某人有帮助!干杯!快乐编码! :D
We tried a lot of things.
We also tried putting the below files in
root
andbin
directories.None of it worked!
We had to put raw
Global.asax
instead ofpre-compiled
dll, in order to fire the global events, for our asp .net 2.0 website.Hope this helps someone! Cheers! Happy coding! :D
尝试以下操作:
try the following:
我在从 vs 2013 发布时遇到了同样的问题,并且以下内容对我有用:
yourproject-->properties-->Web->单击创建虚拟目录。
(即使您在重试之前创建了虚拟目录)
希望这会有所帮助。
I had same issue while publishing from vs 2013 and following worked for me
yourproject-->properties-->Web-> Click on Create Virtual Directory.
(Even though you created virtual directory before try it again)
hope this helps.
尝试发布以下对我有用的文件
App_global.asax.dll
App_global.asax.compiled
PrecompiledApp.config
yoursite.dll
正如 @GabrielG 所说,您必须在发布过程中取消选中预编译,
我希望这对其他人有帮助。
Try to publish the following files this works for me
App_global.asax.dll
App_global.asax.compiled
PrecompiledApp.config
yoursite.dll
and as @GabrielG said you have to uncheck precompile during publishing
I hope this help somebody else.