.net System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse 请求失败,HTTP 状态为 404
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2694150/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse request failed with HTTP status 404
提问by John Adams
I am trying to make some enhancements to a production web app. After quite a bit of unit testing on my WinXP IIS 5.1 development machine, everything works on my localhost so I used the Visual Studio 2008 PUBLISH dialog on my Dev PC to push the following projects to a staging server:
我正在尝试对生产网络应用程序进行一些改进。在我的 WinXP IIS 5.1 开发机器上进行了相当多的单元测试后,一切都在我的本地主机上运行,所以我在我的开发 PC 上使用 Visual Studio 2008 发布对话框将以下项目推送到临时服务器:
- the primary web app
- the "primary" webservice (the home page tries to invoke this WS)
- a "secondary" webservice (not yet a problem because home page does not invoke this WS)
- 主要的网络应用程序
- “主要”网络服务(主页尝试调用此 WS)
- “辅助”网络服务(还不是问题,因为主页不调用此 WS)
I get the following when I try to browse to the home page of the web app typing this into my browser: myUglyURL
当我尝试浏览到 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
Version Information: Microsoft .NET Framework Version:2.0.50727.3607; ASP.NET Version:2.0.50727.3082
版本信息:Microsoft .NET Framework 版本:2.0.50727.3607;ASP.NET 版本:2.0.50727.3082
Here is a bit of the corresponding source code:
下面是一些相应的源代码:
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
I suspect I may have configured things incorrectly on the staging server. The staging server is Win Server 2003 ServicePack 2 running IIS 6.0. When I published the primary site and the 2 webservices on the staging server called MOJITO I created the physical directories for each on the D drive. Then using INETMGR, I configured the following virtual directories:
我怀疑我可能在登台服务器上配置不正确。临时服务器是运行 IIS 6.0 的 Win Server 2003 ServicePack 2。当我在名为 MOJITO 的临时服务器上发布主站点和 2 个 Web 服务时,我在 D 驱动器上为每个站点创建了物理目录。然后使用INETMGR,我配置了以下虚拟目录:
- zVersion2
- zVersion2wsSQL
- zVersion2wsEmergency
- 版本2
- zVersion2wsSQL
- zVersion2wsEmergency
All of the above are configured to use a new application pool I setup and named zVersion2aspNet20. The default web site for this machine MOJITO is configured to use ASP.NET 1.1 and the IP address is set to (All Unassigned). The production versions of the latter 2 webservices run on the MOJITO machine (named ZipeeeService and EmergencyService respectively).
以上所有内容都配置为使用我设置并命名为zVersion2aspNet20的新应用程序池。这台机器 MOJITO 的默认网站配置为使用 ASP.NET 1.1,IP 地址设置为(All Unassigned)。后 2 个 webservice 的生产版本运行在 MOJITO 机器上(分别命名为 ZipeeeService 和 EmergencyService)。
Can my staging versions of the above webservices (named zVersion2wsSQL and zVersion2wsEmergency respectively) co-exist on the same web server with the same IP address?
我的上述 Web 服务的暂存版本(分别命名为 zVersion2wsSQL 和 zVersion2wsEmergency)能否在具有相同 IP 地址的同一 Web 服务器上共存?
Please note that when I test the zVersion2wsSQL webservice independently (from INETMGR right-mouse and click Browse) it works as expected (i.e. presenting all the methods of the webservice) like this snippet:
请注意,当我独立测试 zVersion2wsSQL 网络服务时(从 INETMGR 鼠标右键单击浏览),它按预期工作(即显示网络服务的所有方法),如下所示:
- GetMessageByType MessageName="Get_x0020_Message_x0020_By_x0020_Type"
- GetMessageByType MessageName="Get_x0020_Message_x0020_By_x0020_Type"
I can test this webmethod by clicking on it and it presents the Test dialog (because it takes a simple datatype and I am invoking it on localhost (i.e. MOJITO):
我可以通过点击这个 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.
I fear I may have rambled with too much information so I will stop but I hope someone can help me as I cannot understand why this request results in a "not found". Thanks.
我担心我的信息可能过多,所以我会停下来,但我希望有人能帮助我,因为我不明白为什么这个请求会导致“未找到”。谢谢。
回答by John Adams
There are many places where the "name" you give something results in something fairly inscrutable (at least to me) when you have to CHANGE the name. Here I had 2 webservices and one primary site and when I PUBLISHed the webservice(s) to a staging server I took pains to put them in their own physical directory. This staging server hosts the production versions of both webservices so I ran into problems when I went to create the virtual directories for the staging versions of the webservices.
在很多地方,当您必须更改名称时,您给出的“名称”会导致相当难以理解(至少对我而言)。在这里,我有 2 个网络服务和一个主站点,当我将网络服务发布到临时服务器时,我煞费苦心地将它们放在自己的物理目录中。这个登台服务器托管了两个 web 服务的生产版本,所以当我为 web 服务的登台版本创建虚拟目录时遇到了问题。
That is, I created them with names distinct from the production versions (e.g. SomeWebSvcVersion2 vs. SomeWebSvc). Then on the Staging server using INETMGR I could Browse these "sites" and the "test" page comes up as expected allowing the INVOKE of webmethods with simple datatypes for input parameters.
也就是说,我使用不同于生产版本的名称创建了它们(例如 SomeWebSvcVersion2 与 SomeWebSvc)。然后在使用 INETMGR 的登台服务器上,我可以浏览这些“站点”,并且“测试”页面按预期出现,允许使用简单数据类型的输入参数调用 webmethods。
I discovered that these "arbitrary" names for the virtual directories are not OK. They must match up with the names in the App.Config for my proxy classes that wrap each web service. So in the case of the error above, the App.Config contained:
我发现这些虚拟目录的“任意”名称是不正确的。它们必须与 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>
The reference.vb file compiled into my proxyclass dll requires a virtual directory on the staging server called ZipeeeWebService and my attempts to configure the new version published to the staging server with a different virtual directory name were wrong.
编译到我的代理类 dll 中的 reference.vb 文件需要在登台服务器上有一个名为 ZipeeeWebService 的虚拟目录,我尝试使用不同的虚拟目录名称配置发布到登台服务器的新版本是错误的。
I hope these notes may be helpful to somebody. Case closed.
我希望这些笔记可能对某人有所帮助。案件结案。

