2

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

  • 主要网络应用
  • “主要”网络服务(主页尝试调用此 WS)
  • 一个“辅助”网络服务(还不是问题,因为主页没有调用这个 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,我配置了以下虚拟目录:

  • zVersion2
  • zVersion2wsSQL
  • zVersion2ws紧急情况

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

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

请注意,当我独立测试 zVersion2wsSQL 网络服务(从 INETMGR 鼠标右键单击浏览)时,它按预期工作(即呈现网络服务的所有方法),如下所示:

  • GetMessageByType MessageName="Get_x0020_Message_x0020_By_x0020_Type"

我可以通过单击它来测试这个 webmethod,它会显示 Test 对话框(因为它需要一个简单的数据类型,并且我在 localhost(即 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

1 回答 1

4

当您必须更改名称时,在许多地方,您给出的“名称”会导致一些相当难以理解的事情(至少对我而言)。在这里,我有 2 个 web 服务和一个主站点,当我将 web 服务发布到临时服务器时,我煞费苦心地将它们放在自己的物理目录中。这个登台服务器托管两个 Web 服务的生产版本,所以当我为 Web 服务的登台版本创建虚拟目录时遇到了问题。

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

我发现虚拟目录的这些“任意”名称不正确。它们必须与包装每个 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>

编译到我的代理类 dll 中的 reference.vb 文件需要临时服务器上名为 ZipeeeWebService 的虚拟目录,而我尝试使用不同的虚拟目录名称配置发布到临时服务器的新版本是错误的。

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

于 2010-04-23T20:48:35.430 回答