Debugging your Active
Server Component while its running in the web server A Visual
Studio with C++ Tip for VB and C++ Programmers
It is possible to debug your VB or C++ component while it is in
operation in a IIS Web server. The following article talks about what you
need to do to make this work.
Setup of NT Authority You will need to
give yourself authority to act as part of the operating system. To do this
simply run the User Manager found in your Administration Tools from your
Start Button. Click on Policies | User Rights. Check the "Show Advanced
User Rights" box. Select the "Act as Part of the Operating System". Add
your account to this category. Do the same for "Generate Security Audits".
Now you will have to logoff and log back on to get your new ACL's.
Next you will need to stop the WWW Service and all other installed Web
Services such as FTP and Gopher.
Visual Basic Notes You will need to open
your VB ActiveX DLL project and select Project | Properties. On the 3rd
tab you will notice a check box on the right for "Build Symbolic Debug
Info". Check this box. Now rebuild your DLL and install it on the web
server your will be debugging.
On to Visual Studio Open Visual Studio.
You will need to have Visual C++ 5.x installed for this to work. A
variation will work with MSDev 4.x as well. Open a new workspace ( File |
Open Workspace ). Change the file type to *.exe. Find your inetinfo.exe
file. New installations have it under your winnt/system32/inetpub
directory. Upgrades from old IIS1.0 will have it under inetpub/ just above
your wwwroot directory. Use this to open your workspace. Select Project |
Settings, click on the debug tab. Enter -e w3svc into the command
line box. Change the dropdown listbox to read "Additional DLL's" instead
of "General". Now click at the top of the listbox and then browse to your
DLL that was created by VB. Select OK. Now select File | Open in Visual
Studio and open your .CLS file that visual basic is storing your class
source code in. With this file open you can select the line you want to
break on and press F9 to set a breakpoint.
Debugging Press F5 to start the web
service from within Visual Studio. Open your web browser and open the page
that will run the section of code you just set the breakpoint on. When IIS
tries to execute that part of the code it will bring Visual Studio up and
let you step through your code.
If you have set this up and it is still not working try rebuilding your
component. Make sure each step is followed exactly. If you still have
trouble let us know what your did and what its doing. We can try to help
out. Just drop us a line on the Mentor.
Good Luck, Tim
Cederquist Senior Consultant |