Tôi đang cố gắng gỡ lỗi một Bộ xử lý HTTP HTTP trong Visual Studio và điểm ngắt không bị ảnh hưởng. Có ai có một ý tưởng về làm thế nào để đi về gỡ lỗi xử lý HTTP trong Visual Studio?Gỡ lỗi Trình xử lý HTTP từ Visual Studio
Tôi sử dụng VS 2010 cao cấp, .NET 4.0 trên Windows 7 máy. Trong ứng dụng Web của tôi, tôi có một Handler HTTP trong /HTTPHandler/TrackingHandler.cs
Sau đây là trong cấu hình web của tôi file:
<system.webServer>
<handlers>
<add name="TrackingHandler" path="/tx/*" verb="*" type="ProjectNamespace.TrackingHandler" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
</system.webServer>
My HTTP Handler trông giống như dưới đây
namespace ProjectNamespace
{
public class TrackingHandler : IHttpHandler
{
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
//Breakpoint on the very first line below
string tracker = Path.GetFileName(context.Request.PhysicalPath);
.......
}
}
}
Tôi bắt đầu ứng dụng web của mình bằng bất kỳ trang ngẫu nhiên nào trong Visual Studio Debug sử dụng Máy chủ web nội bộ được xây dựng. Sau đó tôi sửa đổi màu sắc URL để trỏ đến các thư mục /tx/ và một số chuỗi ngẫu nhiên sau đó. Ví dụ: URL hiện tại của tôi trông giống như http: // localhost: 53699/tx/sdfs. Tôi nghĩ rằng điều này sẽ kéo lên điểm ngắt trên dòng đầu tiên của ProcessRequest() nhưng nó không.
Tôi biết ơn vì bất kỳ ý tưởng nào.
O. O.
Edit: Các thông tin khác
Trong Thuộc tính dự án, trong Tab Web, tôi chọn Không mở một trang. Đợi yêu cầu từ một ứng dụng bên ngoài. Tôi cũng nhận được một System.Web.HttpException, vì vậy tôi đã đi đến Gỡ lỗi -> Ngoại lệ -> Ngôn ngữ chung Thời gian chạy và chọn hộp bên cạnh System.Web.
Sau đây là dấu vết ngăn xếp của tôi. Nó dường như không nhận được để xử lý của tôi. Tôi đã xác định sai trong cấu hình web của tôi ??
> System.Web.dll!System.Web.StaticFileHandler.GetFileInfo(string virtualPathWithPathInfo, string physicalPath, System.Web.HttpResponse response) + 0x1f7 bytes
System.Web.dll!System.Web.StaticFileHandler.ProcessRequestInternal(System.Web.HttpContext context = {System.Web.HttpContext}, string overrideVirtualPath) + 0xc7 bytes
System.Web.dll!System.Web.DefaultHttpHandler.BeginProcessRequest(System.Web.HttpContext context, System.AsyncCallback callback = {Method = {System.Reflection.RuntimeMethodInfo}}, object state = null) + 0x15c bytes
System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() + 0x2d7 bytes
System.Web.dll!System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication.IExecutionStep step = {System.Web.HttpApplication.CallHandlerExecutionStep}, ref bool completedSynchronously = true) + 0xb9 bytes
System.Web.dll!System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(System.Exception error) + 0x13e bytes
System.Web.dll!System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(System.Web.HttpContext context, System.AsyncCallback cb, object extraData) + 0xf8 bytes
System.Web.dll!System.Web.HttpRuntime.ProcessRequestInternal(System.Web.HttpWorkerRequest wr = {Microsoft.VisualStudio.WebHost.Request}) + 0x1a2 bytes
System.Web.dll!System.Web.HttpRuntime.ProcessRequestNoDemand(System.Web.HttpWorkerRequest wr) + 0x7d bytes
System.Web.dll!System.Web.HttpRuntime.ProcessRequest(System.Web.HttpWorkerRequest wr) + 0x47 bytes
WebDev.WebHost40.dll!Microsoft.VisualStudio.WebHost.Request.Process() + 0x17b bytes
WebDev.WebHost40.dll!Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Microsoft.VisualStudio.WebHost.Connection conn = {System.Runtime.Remoting.Proxies.__TransparentProxy}) + 0x6c bytes
[Appdomain Transition]
WebDev.WebHost40.dll!Microsoft.VisualStudio.WebHost.Server.OnSocketAccept(object acceptedSocket) + 0x83 bytes
mscorlib.dll!System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(object state) + 0x2d bytes
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool ignoreSyncCtx) + 0xb0 bytes
mscorlib.dll!System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() + 0x5a bytes
mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() + 0x147 bytes
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() + 0x2d bytes
[Native to Managed Transition]
Cảm ơn bạn. Tôi không thể tìm thấy ** aspnet_wp.exe ** trong danh sách các quy trình. Tôi đã cố gắng khởi động nó trong VS bằng tùy chọn _ “Không mở trang” _ như được đề cập trong phần chỉnh sửa đối với câu hỏi ban đầu của tôi. Từ ngăn xếp dấu vết tôi nghĩ rằng nó thậm chí không nhận được vào mã của tôi. Tôi luôn chạy VS as ** admin **. –
AttachTo addin không tương thích với VS.NET 2015 –