Unable debugging asmx web services
I try attach to procees w3wp.exe to debug my asmx web service, add breakpoints. But nothing heppends (The breakpoint will not currently be hit. No symbols have been loaded for this document).
I can debug code that call from asmx file in othes projects.
See asmx file:
<%@ WebService Language="vb" Codebehind="~/App_Code/MyWebService.asmx.vb" Class="MyWebService.MyWebService" Debug="true" %>
See Web.config:
<compilation defaultLanguage="vb" debug="true" targetFramework="4.0">
<compilers>
<compiler la开发者_如何学运维nguage="vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" extension=".VB" compilerOptions="/optimize+ /define:Trace=True /imports:Microsoft.VisualBasic,System,System.Collections,System.Data,System.Diagnostics,System.Web,System.Web.Services"/>
</compilers>
</compilation>
I use win 2008 R2, VS 2010 SP1, IIS 7.5, .Net Framework 4 x86.
Is anybody has ideas how I can debug my asmx file?
In Visual Studio, make sure you are running in Debug mode (as opposed to Release mode). Also try deleting your /obj and /bin folders and try rebuilding your entire solution again.
This is what happened to me :
I copy and paste a asmx file and I have new copied asmx file.
I.e, I copy MyWebService.asmx to MyWebService2.asmx Original .asmx file:
<%@ WebService Language="C#" Codebehind="~/App_Code/MyWebService.asmx.cs" Class="MyWebService.MyWebService" Debug="true" %>
I have forgotten to Rename Class Section : Class="MyWebService.MyWebService"
Then the MyWebService2.asmx file contain :
<%@ WebService Language="C#" Codebehind="~/App_Code/MyWebService2.asmx.cs" Class="MyWebService.MyWebService" Debug="true" %>
Even the MyWebService2.asmx.cs file contain MyWebService2, but the asmx file the backend will redirected to : MyWebService
MyWebService2.asmx.cs:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class MyWebService2: System.Web.Services.WebService
{
}
My fault, when I double click the .asmx file, VS will show .asmx.cs file, so makes me confused.
精彩评论