System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse请求失败,HTTP状态404

问题描述:

我正在尝试对生产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. 

我担心我可能已经有太多的信息,天马行空,所以我会停止,但我希望有人能帮助我,我不明白为什么这个请求的结果是“未找到”。谢谢。

当你必须改变名字的时候,有很多地方给你的名字导致了一些相当难以理解的东西(至少对我来说)。在这里,我有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