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

标签 .net http-status-codes

我正在尝试对生产网络应用程序进行一些增强。在我的 WinXP IIS 5.1 开发计算机上进行相当多的单元测试后,一切都在我的本地主机上运行,​​因此我在开发 PC 上使用 Visual Studio 2008 PUBLISH 对话框将以下项目推送到临时服务器:

  • 主要网络应用
  • “主”Web 服务(主页尝试调用此 WS)
  • “辅助”Web 服务(还不是问题,因为主页不调用此 WS)

当我尝试浏览到 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,我配置了以下虚拟目录:

  • z版本2
  • zVersion2wsSQL
  • zVersion2ws紧急

以上所有内容都配置为使用我设置并命名为zVersion2aspNet20的新应用程序池。 native MOJITO 的默认网站配置为使用 ASP.NET 1.1,并且 IP 地址设置为(全部未分配)。后 2 个 Web 服务的生产版本运行在 MOJITO 机器上(分别名为 ZipeeeService 和 EmergencyService)。

我的上述 Web 服务的暂存版本(分别名为 zVersion2wsSQL 和 zVersion2wsEmergency)可以在具有相同 IP 地址的同一 Web 服务器上共存吗?

请注意,当我独立测试 zVersion2wsSQL Web 服务时(从 INETMGR 右键单击​​“浏览”),它按预期工作(即呈现 Web 服务的所有方法),如下代码片段:

  • 按类型获取消息 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 服务的生产版本,因此当我为 Web 服务的登台版本创建虚拟目录时遇到了问题。

也就是说,我使用与生产版本不同的名称创建了它们(例如 SomeWebSvcVersion2 与 SomeWebSvc)。然后,在使用 INETMGR 的临时服务器上,我可以浏览这些“站点”,并且“测试”页面按预期出现,允许使用简单数据类型作为输入参数调用 Web 方法。

我发现虚拟目录的这些“任意”名称并不合适。它们必须与包装每个 Web 服务的代理类的 App.Config 中的名称匹配。因此,在上述错误的情况下,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 的虚拟目录,并且我尝试使用不同的虚拟目录名称配置发布到临时服务器的新版本是错误的。

我希望这些笔记对某人有所帮助。案件结案。

关于.net - System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse 请求失败,HTTP 状态为 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2694150/

相关文章:

c# - CaSTLe Windsor注入(inject)特定组件

c# - 该组件没有由 uri 标识的资源

database - 502 是数据库错误的适当状态代码吗?

HTTP 状态代码 0 - 错误域=NSURLErrorDomain?

http - 使用创建的 201 重定向

rest - 当资源等待电子邮件确认/激活时,202 Accepted 是否合适?

php - curl 和 ping - 如何检查网站是启动还是关闭?

.net - 测试 .NET Windows 窗体 (VB) 应用程序

c# - 我可以使用 C# 自动化 SoapUI 吗?

c# - 更新一个对象中的值更新第二个对象值 ASP.Net identity 2.0