【发布时间】:2010-10-27 10:40:26
【问题描述】:
我被分配了一个使用 VStudio.net 2003 用 VB 编写的 Web 应用程序。我正在尝试在我的本地主机 (VStudio 2008) 上配置源代码,以便我可以探索和了解当前的应用程序(在我开始任何真正的应用程序之前)更改)并且我无法为 Web 服务项目进行调试。
症状 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 方法的代理类时会发生这种情况。
症状 2:在我的 .asmx 文件代码中对将被调用的语句预先设置断点不起作用(即调试器根本不会停止)。
描述完情况,下面是我的 VStudio 解决方案的配置方式:
Service1 - 从 VB - WEB - ASP.NET Web 服务应用程序模板创建的项目;此 Service1 项目包含我要调试的主要 .asmx 源代码。此项目的 Web.config 包含编译 defaultLanguage="vb" debug="true"
ProxyService1 - 从 Windows 创建的单独项目 - [VB] 类库模板;这里 form1.vb 文件被删除;我访问了“添加服务引用”-> 发现(解决方案中的服务),然后在“兼容性”部分中单击“添加 Web 引用”。然后选择上面的Service1,我给它分配一个WSservice1的“web引用名”。这会生成一个 Reference.VB 文件,当我在项目 bin\Debug 文件夹中构建 ProxyService1 类时,会生成一个同名的 .DLL;这个项目有一个带有编译 defaultLanguage="vb" debug="true"
的 App.Config 文件Project1 - 带有调用 Web 服务的 .aspx 和 .vb 文件的主 UI 项目; project1 引用了 ProxyService1.DLL;此项目的 Web.config 包含编译 defaultLanguage="vb" debug="true"。我在这个项目中的一个名为 message.vb 的文件中遇到了一个断点,它看起来大致如下:
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 中的代码:
<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
为了完整起见,这里是Service1项目的.asmx文件中对应的webmethod:
<WebMethod(MessageName:="Get Message By Type")> _
Public Function GetMessageByType(ByVal iMsgType As Integer) As DataSet
con = New SqlConnection(sConnZipeee)
con.Open()
在 IIS 中我知道要检查的每个地方,在项目属性中,我已经检查了要检查或设置的正确调试设置。我已经调试过像这样设置的其他东西,但我真的坚持我错过了这个“解决方案”。
【问题讨论】:
标签: vb.net visual-studio web-services debugging