2011-11-18 42 views
0

我有兩步生成最終輸出的過程。在WCF應用程序上運行aspnet_merge後找不到App_global.asax

首先,我用MSBuild任務預編譯的WCF應用

<AspNetCompiler Debug="false" PhysicalPath="$(RootBuildDir)/DeploymentPackages/Helium" TargetPath="$(RootBuildDir)/Packages/theWCFProj" VirtualPath="/theWCFProj" ></AspNetCompiler> 

在這一點上,如果我在IIS中創建一個應用程序所產生的預編譯Packages/theWCFProj目錄,一切似乎工作。

我然後運行它成功完成命令

<Exec Command='aspnet_merge "$(RootBuildDir)/Packages/theWCFProj" -o theWCFProj_aspnet' /> 

然而,在嘗試加載.SVC網址,或者從一個WCF客戶端調用它,我得到以下錯誤:

Could not load file or assembly 'App_global.asax, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. 

我可以看到但是,該.compiled文件正確指向合併的程序集,因爲App_global.asax.compiled包含:

<?xml version="1.0" encoding="utf-8"?> 
<preserve resultType="8" virtualPath="/theWCFProj/global.asax" hash="ffffffff8d3606ab" filehash="ffffe951d4811dee" flags="150000" assembly="theWCFProj_aspnet" type="ASP.global_asax"> 
    <filedeps> 
    <filedep name="/theWCFProj/global.asax" /> 
    </filedeps> 
</preserve> 

WCF服務託管在IIS7中。

有什麼想法可能會出錯?

回答

0

原來,有人又增加了一箇舊版本System.Query.dll直接到項目,其中預編譯過程中產生的警告:

ASPNETCOMPILER : warning CS1685: The predefined type 'System.Runtime.CompilerServices.ExtensionAttribute' is defined in multiple assemblies in the global alias; using definition from 'c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\theWCFProj\0fd01092 

\ 7b51c9a \裝配\ DL3 \ c17fdca3 \ 777377c3_17a6cc01 \ SYSTEM .Query.DLL'

刪除.dll及其在.csproj文件中的顯式引用可修復此問題。一旦這些預編譯警告消失,WCF服務不再有問題訪問App_global.asax