torsdag den 24. marts 2011

How to debug .net assembly used in ASP3 website

There is still a quite a lot websites left on earth running the good old asp3 code the .asp pages, using the very shitty vb6 com+ components - with the classic dll hell; my old http://www.bsboksen.dk is one of them.

But I have also learned to know the great benefits of developing .net code.

So I decided to get rid of all the shitty vb6 components and keep the existing asp3 webpage with the old vbscript code.

Ok the refactoring of all the vb6 component was a great deal of work, but was still possible to get through quite easy - but hard work.

One of my really big troubles was actually to be able to debug the .net assemblies when executed with the asp3 webpages.

So here is my solution - and it works :-)

Preconditions
Visual Studio is set with debug configuration and the project is compiled with the debug configuration.
A .aspx webpage has been created and can be run in the same ressource pool as the asp3 webpage.

Process to debug
1) Run iisreset
2) Open the aspx page ie.. http://localhost/my-asp-net-webpage.aspx
this will start the w3wp process
3) Attach the visual studio project to w3wp.exe
4) Set a breakpoint in the code
5) Open the asp3 web page ie. . http://localhost/my-asp3-web-page.asp

Now the breakpoint should be hit.