Maxolidean
Maxolidean

Reputation: 487

Classic.ASP calling .NET component via COM

I have a Classic-ASP application running in IIS 7 (integrated mode) that needs to call a .NET library that was properly registered as COM.

Everything seems to work find, but I cannot debug the library even if i put several breakpoints in it. The VS debugger seems to step over without breaking.

This is my ASP code:

Dim sso: Set sso = Server.CreateObject("SecurityPlatform.ClassicASP_SSO")
sso.Initialize()

I can step debug those lines, but it seems impossible to step into Initialize().

Any clue?

Upvotes: 0

Views: 1165

Answers (4)

AnthonyWJones
AnthonyWJones

Reputation: 189457

If you are stepping those lines then you will already be attached to the process for debugging Script. However to debug the code in the .NET component you need to be attached to the process for debugging "Managed Code". You can't step from script into a managed component because you can't debug Script and Managed Code at the same time.

When you attach to the w3wp process make sure the "Attach To:" box contains "Managed Code". Now your break points will work correctly but you won't be able to step the Script code.

Upvotes: 0

Justin Niessner
Justin Niessner

Reputation: 245429

If you're trying to step in to Managed .NET code being called via COM+, make sure you're attaching the Debugger to dllhost.exe rather than w3p.exe (or whatever process is running your web app...depending on your version of IIS).

COM+ code is not executed in process with the web server...

Upvotes: 0

Lee Hesselden
Lee Hesselden

Reputation: 782

If this is an enterprise services/COM+ compoent you might need to manually attach the debugger to the process where the COM component is running. A COM+ component running "out of process" will not have the debugger attached by default.

Last time I did this the process we had to attach to was the last created dllhost (normally highest process id). You can do this via the debug menu of visual studio.

Upvotes: 0

mfeingold
mfeingold

Reputation: 7154

I am not sure why can't you step through but here is one trick:

put a call to System.Diagnostics.Debugger.Break method inside your managed code. Once the execution hits this line a dialog will pop up allowing you to attach VS to it.

Upvotes: 1

Related Questions