global.asax 在本地计算机上工作,但在我发布到服务器后不起作用

发布于 2024-09-17 11:45:03 字数 233 浏览 8 评论 0原文

如何将我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

葵雨 2024-09-24 11:45:04

我们必须在发布配置文件中取消选中“发布期间预编译”功能,这样就成功了。

输入图像描述这里

We had to uncheck the Precompile during publishing feature in our publishing profile and that did the trick.

enter image description here

§普罗旺斯的薰衣草 2024-09-24 11:45:04

检查 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.

毅然前行 2024-09-24 11:45:04

我遇到了同样的问题,发现我还必须将“复制到输出目录”属性设置为“始终复制”

I had the same problem and found that I also had to set Copy to Output Directory property to Copy always

裂开嘴轻声笑有多痛 2024-09-24 11:45:04

我们尝试了很多事情。

  1. Global.asax 未发布,Global.asax 中未触发事件
  2. 为什么我的 ASP .NET 网站中没有触发 Global.asax 事件?
  3. Global .asax 未针对发布版本触发
  4. ASP.NET MVC 应用程序中 Global.asax 之谜

我们还尝试将以下文件放入 rootbin 目录中。

  1. App_global.asax.dllApp_global.asax.compiled 文件
  2. PrecompiledApp.config

都不起作用!

为了为我们的 asp .net 2.0 网站触发全局事件,我们必须使用原始的 Global.asax 而不是预编译的 dll。

希望这对某人有帮助!干杯!快乐编码! :D

We tried a lot of things.

  1. Global.asax is not publishing and event are not firing in Global.asax
  2. Why are the Global.asax events not firing in my ASP .NET website?
  3. Global.asax not firing for Release build
  4. Mystery of Global.asax in ASP.NET MVC application

We also tried putting the below files in root and bin directories.

  1. App_global.asax.dll and App_global.asax.compiled files
  2. PrecompiledApp.config

None of it worked!

We had to put raw Global.asax instead of pre-compiled dll, in order to fire the global events, for our asp .net 2.0 website.

Hope this helps someone! Cheers! Happy coding! :D

山田美奈子 2024-09-24 11:45:04

尝试以下操作:

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
        <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness64" />
    </handlers>

    <validation validateIntegratedModeConfiguration="false" />
</system.webServer>

try the following:

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
        <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness64" />
    </handlers>

    <validation validateIntegratedModeConfiguration="false" />
</system.webServer>
老街孤人 2024-09-24 11:45:04

我在从 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.

め七分饶幸 2024-09-24 11:45:04

尝试发布以下对我有用的文件

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文