2010-04-22 238 views
2

我正在嘗試對生產Web應用程序進行一些增強。經過相當多的在我的WinXP單元測試的IIS 5.1的開發機,一切工作在我的本地所以我使用了Visual Studio 2008的發佈我的開發PC上對話,推動以下項目臨時服務器:System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse請求失敗,HTTP狀態404

  • 的主要的Web應用程序
  • 「主」 web服務(主頁試圖調用這個WS)
  • 「次要」 web服務(還不是一個問題,因爲主頁不調用此WS)

我得到以下結果g當我嘗試瀏覽到Web應用程序中輸入到這個瀏覽器的主頁:myUglyURL

Server Error in '/zVersion2' Application. 
The request failed with HTTP status 404: Not Found. 
Description: An unhandled exception occurred during the execution of the current web request.Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Net.WebException: The request failed with HTTP status 404: Not Found. 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 

[WebException: The request failed with HTTP status 404: Not Found.] 
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +431289 
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +204 
ProxyZipeeeService.WSZipeee.Zipeee.GetMessageByType(Int32 iMsgType) in C:\Documents and Settings\johna\My Documents\Visual Studio 2008\Projects\ProxyZipeeeService\ProxyZipeeeService\Web References\WSZipeee\Reference.vb:2168 
Zipeee.frmZipeee.LoadMessage() in C:\Documents and Settings\johna\My Documents\Visual Studio 2008\Projects\Zipeee\frmZipeee.aspx.vb:43 
Zipeee.frmZipeee.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\johna\My Documents\Visual Studio 2008\Projects\Zipeee\frmZipeee.aspx.vb:33 
System.Web.UI.Control.OnLoad(EventArgs e) +99 
System.Web.UI.Control.LoadRecursive() +50 
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627 

版本信息:Microsoft .NET Framework版本:2.0.50727.3607; ASP.NET版本:2.0.50727.3082

這裏是一個位對應的源代碼:

Public wsZipeee As New ProxyZipeeeService.WSZipeee.Zipeee 
Dim dsStandardMsg As DataSet 
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 
    If Not Page.IsPostBack Then 
     LoadMessage() 
    End If 
End Sub 

Private Sub LoadMessage() 
    Dim iCnt As Integer 
    Dim iValue As Integer 

    dsStandardMsg = wsZipeee.GetMessageByType(BizConstants.MsgType.Standard) 
End Sub 

我懷疑我可能已經在臨時服務器上配置不正確的事情。登臺服務器是運行IIS 6.0的Win Server 2003 ServicePack 2。當我在名爲MOJITO的登臺服務器上發佈主站點和2個Web服務時,我爲D盤上的每個站點創建了物理目錄。然後使用INETMGR,我配置了以下虛擬目錄:

  • zVersion2
  • zVersion2wsSQL
  • zVersion2wsEmergency

上述所有配置爲使用新的應用程序池我的設置和命名zVersion2aspNet20。本機的默認網站MOJITO配置爲使用ASP.NET 1.1,IP地址設置爲(全部未分配)。後兩種web服務的生產版本在MOJITO機器上運行(分別命名爲ZipeeeService和EmergencyService)。

我的上述web服務(分別命名爲zVersion2wsSQL和zVersion2wsEmergency)的暫存版本可以共存於具有相同IP地址的同一臺Web服務器上嗎?

請注意,當我獨立測試zVersion2wsSQL web服務(從INETMGR鼠標右鍵,然後單擊Browse),它按預期工作(即呈現web服務的所有方法),這樣的片段:

  • GetMessageByType MessageName =「Get_x0020_Message_x0020_By_x0020_Type」

我可以通過點擊測試此的WebMethod,並給出了測試對話框(因爲它需要一個簡單的數據類型,我調用它在本地主機(即MOJITO):

**Get Message By Type** 

**Test** 
To test the operation using the HTTP POST protocol, click the 'Invoke' button. 
Parameter Value 
iMsgType: _______     [INVOKE button] 

SOAP 1.1 ....etc. 

我擔心我可能已經有太多的信息,天馬行空,所以我會停止,但我希望有人能幫助我,我不明白爲什麼這個請求的結果是「未找到」。謝謝。

回答

4

當你必須改變名字的時候,有很多地方給你的名字導致了一些相當難以理解的東西(至少對我來說)。在這裏,我有2個Web服務和一個主站點,當我將Web服務發佈到臨時服務器時,我花了很大力氣把它們放到他們自己的物理目錄中。這臺登臺服務器承載了兩個網絡服務的生產版本,所以當我去創建Web服務的登臺版本的虛擬目錄時遇到了問題。

也就是說,我使用不同於生產版本的名稱(例如SomeWebSvcVersion2與SomeWebSvc)創建它們。然後在使用INETMGR的登臺服務器上,我可以瀏覽這些「站點」和「測試」頁面,如預期的那樣允許具有簡單數據類型的webmethods的INVOKE輸入參數。

我發現虛擬目錄的這些「任意」名稱不正確。它們必須與App.Config中用於包裝每個Web服務的代理類的名稱匹配。因此在上面的錯誤的情況下,在app.config包含:

<applicationSettings> 
    <ProxyZipeeeService.My.MySettings> 
     <setting name="ProxyZipeeeService_WSZipeee_Zipeee" serializeAs="String"> 
      <value>http://localhost/ZipeeeWebService/Zipeee.asmx</value> 
     </setting> 
    </ProxyZipeeeService.My.MySettings> 
</applicationSettings> 

編譯成我proxyclass的DLL文件reference.vb需要叫ZipeeeWebService臨時服務器上的虛擬目錄,然後我嘗試配置新版本使用不同的虛擬目錄名稱發佈到登臺服務器是錯誤的。

我希望這些筆記可能對某人有幫助。案件結案。

+0

是的,他們很有用,謝謝。虛擬目錄是一個真正的痛苦= / – Francisco 2015-06-16 15:34:02

相關問題