global.asax works on local computer but not after

2020-02-01 04: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.

7条回答
劫难
2楼-- · 2020-02-01 04:41

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>
查看更多
在下西门庆
3楼-- · 2020-02-01 04:42

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.

查看更多
闹够了就滚
4楼-- · 2020-02-01 04:49

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

enter image description here

查看更多
劳资没心,怎么记你
5楼-- · 2020-02-01 04:52

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.

查看更多
Emotional °昔
6楼-- · 2020-02-01 04:53

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

查看更多
ら.Afraid
7楼-- · 2020-02-01 04:58

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.

查看更多
登录 后发表回答