12

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.

Ryan Gates
  • 4,501
  • 6
  • 50
  • 90
Letseatlunch
  • 2,432
  • 7
  • 28
  • 33

7 Answers7

9

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

enter image description here

Gabriel G
  • 680
  • 8
  • 7
5

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.

Sander Rijken
  • 21,376
  • 3
  • 61
  • 85
  • its wierd i only get these options when i right click on the global.asax file:, Open, Open With..., Exclude from project, Cut, Copy, Delete, Rename. But there are No properties or anything else – Letseatlunch Sep 06 '10 at 04:55
  • 3
    Highlight the global.asax file in the solution explorer and press ALT+ENTER to bring up the properties window for the file. Check the build action is set to content – Russ Cam Sep 07 '10 at 06:57
  • Hi, ALT + ENTER shows only filename and the file location. I am using VS2012 website. Could you please help me how to set global.asax build action – Esen Feb 02 '13 at 14:36
  • 2
    I'm pretty sure build action is only available for web applications. This is a website – Jared Beach May 14 '15 at 11:49
4

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

HpTerm
  • 8,151
  • 12
  • 51
  • 67
Rich
  • 140
  • 7
3

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

Community
  • 1
  • 1
Devraj Gadhavi
  • 3,541
  • 3
  • 38
  • 67
1

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>
Saro Taşciyan
  • 5,210
  • 5
  • 31
  • 50
1

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.

Grasshopper
  • 1,778
  • 6
  • 27
  • 48
0

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.

Diego Arturo
  • 171
  • 1
  • 3
  • 15