2013-02-22 61 views
0

當我開發WCF服務或網站解決方案時,我總是使用IISExpress和自定義配置文件,以便我可以與團隊中的其他開發人員共享設置。基本上,我在它運行具有以下命令的批處理文件:具有自定義配置文件的IISExpress 8 - Web服務不會加載

「C:\ Program Files文件(x86)的\ IIS快遞\ iisexpress.exe」 /config:service-hosts.config

服務 - 在哪裏hosts.config是我的自定義配置文件的路徑。

此方法一直工作得很好,並且在我的PC上的其他解決方案(每個都有自己的service-hosts.config文件)中仍可正常工作。不過,我剛開始有一個問題,使用這種方法加載WCF服務。試圖瀏覽到服務的根目錄時,我收到以下錯誤,或任何內置的幫助端點:


HTTP錯誤500.19 - 內部服務器錯誤 請求的頁面不能因爲相關的訪問該頁面的配置數據無效。

詳細錯誤信息:

模塊IIS Web核心

通知未知

處理程序尚未確定

錯誤代碼0x80070003

配置錯誤無法讀取配置文件

配置文件\ \ d:\項目\ MyProject的\ WCFSite \ web.config中

請求的URL的http://本地主機:80/

物理路徑

登錄方法尚未確定

登錄用戶尚未確定

跟蹤目錄c請求:\用戶\ Spikeh \文檔\ IISExpress \ TraceLogFiles \

配置來源:

-1:

0: 

更多信息:

當有閱讀Web服務器或Web應用程序的配置文件有問題,會出現此錯誤。在某些情況下,事件日誌可能包含有關導致此錯誤的更多信息。

如果您看到文本「存在重複的'system.web.extensions/scripting/scriptResourceHandler'部分定義」,則此錯誤是因爲您正在.NET Framework 4中運行基於.NET Framework 3.5的應用程序。如果您正在運行WebMatrix,要解決此問題,請轉到設置節點以將.NET Framework版本設置爲「.NET 2」。您也可以從web.config文件中刪除多餘的部分。

查看更多信息»


我已經調試了幾個小時,並不能得到這個錯誤發生變化,更不用說修復它。

我試着用幾個不同版本的applicationHosts.config覆蓋我的service-hosts.config文件,在64位運行IISExspress,用一個非常基本的版本替換web.config文件,設置目錄的權限(to在我的電腦上每個用戶都可以訪問),並更改應用程序池,但仍然沒有改變。

奇怪的是...當我改變WCF項目使用項目屬性的Web部分中的「IISExpress」,然後調試項目,一切工作正常...即使與我所有的web.config設置到位。

這指向我如何運行IISExpress或我的service-hosts.config文件......雖然service-hosts.config文件(對涉及的站點進行了輕微修改)與它完全相同我的其他項目。

有一點需要注意(可能是紅鯡魚),但我確實將解決方案從VS2012降級到VS2010,並將框架目標更改爲.Net 4.0 ...不確定是否可以配置某些東西?

有沒有人有任何想法?我在跳下屋頂的點...

UPDATE:

下面是從IISExpress調試信息(與/跟蹤運行:E):

Running IIS... 
    Starting IIS Express ... 
    Initializing the W3 Server Started CTC = 5514916 
    PreInitSitesThread: Premature Exit Occured (hr = 80070003) 
    W3 Server initializing WinSock. CTC = 5514916 
    W3 Server WinSock initialized. CTC = 5514916 
    W3 Server ThreadPool initialized (ipm has signalled). CTC = 5514916 
    Start listenerChannel http:0 
    Successfully registered URL "http://*:80/" for site "MyWebsite" application "/" 
    Registration completed for site "MyWebsite" 
    AppPool 'MyCustomAppPool' initialized 
    InitComplete event signalled 
    IIS Express is running. 
    Enter 'Q' to stop IIS Express 
    IncrementMessages called 
    Request ended: http://localhost:80/ with HTTP status 500.19 

而這裏的重要我的服務hosts.config的一部分:

<applicationPools> 
    <add name="Clr4IntegratedAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" autoStart="true" /> 
    <add name="Clr4ClassicAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" autoStart="true" /> 
    <add name="Clr2IntegratedAppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" autoStart="true" /> 
    <add name="Clr2ClassicAppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" autoStart="true" /> 
    <add name="UnmanagedClassicAppPool" managedRuntimeVersion="" managedPipelineMode="Classic" autoStart="true" /> 
    <add name="IISExpressAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_BIN%\config\templates\PersonalWebServer\aspnet.config" autoStart="true" /> 

    <add name="MycustomAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" /> 

    <applicationPoolDefaults managedRuntimeLoader="v4.0" > 
     <processModel/> 
    </applicationPoolDefaults> 
</applicationPools> 

<listenerAdapters> 
    <add name="http" /> 
</listenerAdapters> 

<sites> 
    <site name="MyWebsite" id="1"> 
     <application path="/" applicationPool="MyCustomAppPool"> 
      <virtualDirectory path="/" physicalPath="D:\Projects\MyProject\WCFSite\" /> 
     </application> 
     <bindings> 
      <binding protocol="http" bindingInformation="*:80:" /> 
     </bindings> 
    </site> 
    <siteDefaults> 
     <logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" /> 
     <traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" /> 
    </siteDefaults> 
    <applicationDefaults applicationPool="Clr4IntegratedAppPool" /> 
    <virtualDirectoryDefaults allowSubDirConfig="true" /> 
</sites> 

<webLimits /> 

回答

1

似乎service-hosts.config文件指向了它本來不應該指向的東西。我使用舊項目的副本(因此是舊版本的IISExpress/.Net Framework)替換了我的service-hosts.config,一切正常。

聽起來好像是我的4.5 - > 4.0降級。

相關問題