无法在Visual Studio 2008中调试Web服务项目 [英] Unable to debug web service project in Visual Studio 2008

查看:153
本文介绍了无法在Visual Studio 2008中调试Web服务项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已为我分配了一个使用VStudio.net 2003用VB编写的Web应用程序。我正在尝试在本地主机(VStudio 2008)上配置源,以便可以探索和了解当前应用程序(在开始任何真正的应用之前)。更改),并且我无法调试Web服务项目。

I've been assigned a web app written in VB using VStudio.net 2003. I am trying to configure the source on my localhost (VStudio 2008) so I can explore and learn about the current app (before I begin any real changes) and I cannot get debugging working for the web service project(s).

症状1:

 "Unable to automatically step into the server. The remote procedure could not be debugged. 
  This usually indicates that debugging has not been enabled on the server.
  See help for more information". 

当我尝试F11(stepInto)代理类来调用实际的Web方法时,就会发生这种情况。

This happens when I try to F11 (stepInto) the proxy class which invokes my actual web method.

症状2:在要调用的语句的.asmx文件代码中预先设置一个断点将不起作用(即调试器不会停止)。

Symptom 2: Pre-setting a breakpoint in my .asmx file code on the statement that will be invoked does not work (i.e. the debugger simply doesn't stop).

已经描述了这种情况,以下是我的VStudio解决方案的配置方式:

Having described the situation, here's how my VStudio Solution is configured:

Service1 >-从VB创建的项目-WEB-ASP.NET Web服务应用程序模板;该Service1项目包含我要调试的主要.asmx源代码。此项目的Web.config包含编译defaultLanguage = vb debug = true

Service1 - project created from the VB - WEB - ASP.NET Web Service Application template; this Service1 project contains my main .asmx source code I want to debug. Web.config for this project contains compilation defaultLanguage="vb" debug="true"

ProxyService1 -从Windows创建的单独项目- [VB]类库模板;在这里,form1.vb文件已删除;我访问了添加服务参考->发现(解决方案中的服务),然后在兼容性部分中单击添加Web参考。然后选择上面的Service1,我为其分配一个WSservice1的 Web参考名称。这将生成一个Reference.VB文件,并且当我构建ProxyService1类时,在项目bin\Debug文件夹中将同名的.DLL插入;这个专案有一个App.Config档案,其编译为defaultLanguage = vb debug = true

ProxyService1 - a separate project created from the Windows - [VB]Class Library template; here the form1.vb file was deleted; I visited "Add Service Reference" -> Discover (Services in solution) and then in the "Compatibility" section I click "Add Web Reference". Then choosing the above Service1, I assign it a "web reference name" of WSservice1. This results in a Reference.VB file and when I build the ProxyService1 class a .DLL of the same name in the projects bin\Debug folder; this project has an App.Config file with compilation defaultLanguage="vb" debug="true"

Project1 -主UI项目调用Web服务的.aspx和.vb文件; project1引用了ProxyService1.DLL;此项目的Web.config包含编译defaultLanguage = vb debug = true。我在该项目中一个名为message.vb的文件中到达一个断点,该断点大致如下所示:

Project1 - the main UI project with the .aspx and .vb files that call the webservice; project1 has a reference to ProxyService1.DLL; Web.config for this project contains compilation defaultLanguage="vb" debug="true". I arrive at a breakpoint in one of the files in this project called message.vb which looks roughly like this:

Public Class Message
Dim wsZipeee As New ProxyService1.WSservice1.myService
Dim dsMessage As DataSet
Public Function GetMessageByType(ByVal iMsgType As Integer) As DataSet
    dsMessage = wsZipeee.GetMessageByType(iMsgType)

如果我在上面的stmt上鼠标右键/转到定义,这是我的ProxyService1中Reference.vb中的代码项目:

If I rightmouse/go to definition on the stmt above, here is the code in Reference.vb in my ProxyService1 project:

    <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/ZipeeeWebService/Zipeee/Get Message By Type", RequestElementName:="Get Message By Type", RequestNamespace:="http://tempuri.org/ZipeeeWebService/Zipeee", ResponseElementName:="Get Message By TypeResponse", ResponseNamespace:="http://tempuri.org/ZipeeeWebService/Zipeee", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)>  _
    Public Function GetMessageByType(ByVal iMsgType As Integer) As <System.Xml.Serialization.XmlElementAttribute("Get Message By TypeResult")> System.Data.DataSet
        Dim results() As Object = Me.Invoke("GetMessageByType", New Object() {iMsgType})
        Return CType(results(0),System.Data.DataSet)
    End Function

为完整起见,以下是.asmx文件中相应的web方法Service1项目:

For completeness, here is the corresponding webmethod in the .asmx file of the Service1 project:

<WebMethod(MessageName:="Get Message By Type")> _
 Public Function GetMessageByType(ByVal iMsgType As Integer) As DataSet
    con = New SqlConnection(sConnZipeee)
    con.Open()

我知道要检查IIS中的每个地方,并且在项目属性中,我已经检查了要检查或设置的正确Debug设置。我已经调试了像这样设置的其他内容,但是我确实陷入了我在此解决方案中所错过的东西。

Everyplace in IIS I know to check and within the project properties I have checked for the proper Debug setting to be checked or set on. I've debugged other things that are set up like this but I am truly stuck on what I've missed on this "solution".

推荐答案

调试Web服务时,通常在项目属性的Web部分中选择选项不要打开页面。等待来自外部应用程序的请求(在此处获取更多信息 )。我通常还会在2个VS实例中运行该项目,一个实例用于Web服务,另一个实例用于客户端。我可以在Web服务中放置断点,然后一切都击中,我可以看到正在发生的事情。

When I debug webservices, I usually select the option "Don't open a page. Wait for a request from an external application" in the Web section of my project properties (more info here). I also usually run the project in 2 instances of VS, one for webservice and one for client. I can put break points in the webservice and everything hits and I can see what is happening.

这篇关于无法在Visual Studio 2008中调试Web服务项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆