Visual Studio debugger does not attach when at the root of the site

I had a problem with my Visual Studio 2008 debugger, not related to the root of the default website when I start from the environment.

I have a .NET 3.5 web application project running on VS 2008 SP1. I set the project to "Use the local IIS web server" with the outline " http: // localhost / ". I can create a virtual directory and the application compiles fine.

My problem is that when IE starts the debugger, it is not connected. I can "Attach to the process" and select "w3wp.exe", and it will debug just fine. This is PITA, and I was curious if anyone knows why this will not be automatically attached?

I used this exact project under VD and never had a problem with lack of debugging. Thoughts?

+5
source share
5 answers

The problem I ran into is that I had a tag in my web.config that surrounded my tag. This obviously causes the debugger to attach, and then immediately throw an error without any warnings or errors. Here is an article I used to figure this out:

http://www.west-wind.com/WebLog/posts/466163.aspx

+16
source

I would try to start VS using an administrator account.

0
source

- ?
-. . - - ( , ).
web.config IIS .

0

VS, Visual Studio, , , w3wp.exe . , , . . , IE , Firefox. , IE , .

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics

Public Module AttachToWebServer

    Public Sub AttachToWebServer()

        Dim AspNetWp As String = "aspnet_wp.exe"
        Dim W3WP As String = "w3wp.exe"

        If Not (AttachToProcess(AspNetWp)) Then
            If Not AttachToProcess(W3WP) Then
                System.Windows.Forms.MessageBox.Show(String.Format("Process {0} or {1} Cannot Be Found", AspNetWp, W3WP), "Attach To Web Server Macro")
            End If
        End If

    End Sub

    Public Function AttachToProcess(ByVal ProcessName As String) As Boolean
        Try
            Dim ProcessFound As Boolean = False
            Dim dbg2 As EnvDTE80.Debugger2 = DTE.Debugger
            Dim trans As EnvDTE80.Transport = dbg2.Transports.Item("Default")
            Dim dbgeng(10) As EnvDTE80.Engine
            Dim indexer As Integer = 0

            For Each myEngine As Engine In trans.Engines
                'Possible values here could be "T-SQL","Native","Managed","Workflow" "Managed/Native", "Script"
                If myEngine.Name.Equals("Managed") Then
                    dbgeng(indexer) = myEngine
                    indexer += 1
                End If
            Next

            Dim processes As EnvDTE.Processes = dbg2.GetProcesses(trans, "localhost")
            For Each Process As EnvDTE80.Process2 In processes
                If Process.Name.Contains(ProcessName) Then
                    Process.Attach2(dbgeng)
                    ProcessFound = True
                End If
            Next
            Return ProcessFound
        Catch ex As System.Exception
            MsgBox(ex.Message)
        End Try
    End Function

End Module
0

, .

-, , - . -, .

. , -, , , : - dev-web-, , -.

0

All Articles