« Previous Next »

Thread: Is there a way to debug a custom module from VS.NET 2005?

Last post 06-22-2006 12:38 PM by mvolo. 6 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (7 items)

Sort Posts:

  • 06-15-2006, 4:22 AM

    Is there a way to debug a custom module from VS.NET 2005?

    Is there a way to debug a custom managed module from VS.NET 2005 when it is loaded within IIS7? I have tried to attach to the W3WP worker process but not having any luck.

    I just get a message similar to the following:

    --------------------------
    Microsoft Visual Studio
    ---------------------------
    The following module was built either with optimizations enabled or without debug information:

    C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\files\7ffbcf90\718ddfc2\assembly\dl3\8fe7a95a\e0bbdb42_d489c601\BasicAuthenticationModule.DLL

    To debug this module, change its project build configuration to Debug mode. To suppress this message, disable the 'Warn if no user code on launch' debugger option.

     

    The module in question was built with Debug Information. I have the .PDB file in the BIN directory and I have even placed it into the folder listed above in the error message but it does not help me.

    Cheers

    Chris

     

    Chris Crowe
    http://blog.crowe.co.nz
  • 06-15-2006, 7:27 AM In reply to

    • bills
    • Top 25 Contributor
    • Joined on 02-03-2006, 5:33 PM
    • Redmond, WA
    • Posts 433

    Re: Is there a way to debug a custom module from VS.NET 2005?

    you're on the right track by attaching to the worker process.  try adding this snipped of config to your web.config file:

    <configuration>
    <compilation debug="true"/>
    </configuration>

    bill

    ~~~~~~~~~~~~~~~~~~~~~~~~
    Bill Staples
    Product Unit Manager, IIS
    blog: http://blogs.iis.net/bills
  • 06-15-2006, 12:05 PM In reply to

    • mvolo
    • Top 25 Contributor
    • Joined on 09-17-2003, 1:48 PM
    • Philadelphia, PA
    • Posts 584
    • IIS MVPs

    Re: Is there a way to debug a custom module from VS.NET 2005?

    Also, if you are precompiling your module and dropping the .DLL in the /BIN directory, you need to make sure you are compiling in the debug configuration within VS and dropping the .PDB file in the /BIN directory as well.

    Also, in this case you may need to turn off the "Just My Code" feature of Visual Studio by going into Tools>Options>Debugging node in the tree, and unchecking the "Just My Code" checkbox when attached.

    If you are simply adding the source code into the App_Code directory, then follow Bill's advice above to compile it with debug symbols.

    When you are attached, a handy way to check whether you will be able to debug the module is to go to Debug > Windows > Modules (disclaimer: nothing to do with IIS modules :)), and make sure that symbols are loaded for the dll you are trying to debug.  If not, there was a problem with the symbols and most likely you need to tell VS where to find the PDB, or your source code/DLL is out of sync with the PDB you are trying to load.

    Hope this helps.

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • 06-15-2006, 5:44 PM In reply to

    Re: Is there a way to debug a custom module from VS.NET 2005?

    mvolo:

    Also, if you are precompiling your module and dropping the .DLL in the /BIN directory, you need to make sure you are compiling in the debug configuration within VS and dropping the .PDB file in the /BIN directory as well.

    Hi Mike

    Thanks for trying to help me but I am still having problems with this:

    Basically I have this configuration:

    1) ASP.NET Web Site
    2) BasicAuth Project

    ASP.NET Web Site pointed to IIS Home Directory (c:\inetpub\websites\basicauth.vista)

    My ASP.NET Web Site project in VS.NET references my BasicAuth project.

    -----

    • I stop the worker proesss
    • I start the worker process
    • I request a page so that W3WP.EXE starts up
    • I click Debug - Attach to process in VS.NET 2005
    • I set the attach to to Managed Code
    • I select the W3WP Process from the available process list.
    • I click attach.

    I then select BasicAuth.CS and place a breakpoint.

    I then fire the code in the browser which should trigger the breakpoint but the breakpoint has changed to a broken debug symbol and a message "No symbols have been loaded for this document"

    When I go to Debug-Windows-Modules I get a line for my BasicAuth.DLL saying it is not optimized and that Symbols are loaded.  It also says user N/A under the UserCode column.

    I have turned off the option "Just My Code"

    Any other thoughts?

    Chris

    Chris Crowe
    http://blog.crowe.co.nz
  • 06-16-2006, 11:38 AM In reply to

    • mvolo
    • Top 25 Contributor
    • Joined on 09-17-2003, 1:48 PM
    • Philadelphia, PA
    • Posts 584
    • IIS MVPs

    Re: Is there a way to debug a custom module from VS.NET 2005?

    Can you double check that you are attaching with "Managed Code" debugging (configured in "Attach to:" in that Attach dialog box before you click Attach).  If it says "Automatic: Native Only" then it could explain this.

    If that doesnt work, I am out of ideas ...

    You can try a temporary workaround - instead of compiling the module and dropping the .DLL in /BIN, just put the source code in the /App_Code directory to have it be compiled with your application.

    Make sure to set <compilation debug="true" />.
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • 06-16-2006, 3:52 PM In reply to

    Re: Is there a way to debug a custom module from VS.NET 2005?

    mvolo:
    Can you double check that you are attaching with "Managed Code" debugging (configured in "Attach to:" in that Attach dialog box before you click Attach).  If it says "Automatic: Native Only" then it could explain this.

    If that doesnt work, I am out of ideas ...

    Hi Mike

    I finally found my problem - it was my fault - I was replacing the DLL in the BIN folder of the web site which would have worked fine. But I created a virtual directory for the Authentication Test and it had its own BIN directory with an old version of the DLL. Hence my problem....

    Thanks for your help...

    Chris

    Chris Crowe
    http://blog.crowe.co.nz
  • 06-22-2006, 12:38 PM In reply to

    • mvolo
    • Top 25 Contributor
    • Joined on 09-17-2003, 1:48 PM
    • Philadelphia, PA
    • Posts 584
    • IIS MVPs

    Re: Is there a way to debug a custom module from VS.NET 2005?

    I was going to suggest saying "abra cadabra" next, but glad it didnt come to that :)

    This posting is provided "AS IS" with no warranties, and confers no rights.
Page 1 of 1 (7 items)
Microsoft Communities