0

I am using Visual Studio 2008 to (eventually) debug a classic ASP web site. I have gone through all the steps required to set things up but it complains about my web.config file. It looks fine to me but it throws errors.

First I tried this simple one:

simple web.config setting

but the error it gave complained about the compilation tag. I thought that the compilation tag was required in order to do debugging.

Here is the error

enter image description here

Just to make sure there was no typo, I copied over a generated web.config from Visual Studio 2019

But that did not change the original complaint and generated another complaint about the first line:

enter image description here

Finally, thinking it might have something to do with the closing of the tag, mentioned here https://learn.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/s10awwz0(v=vs.100)?redirectedfrom=MSDN I tried this web.config:

<configuration>
    <system.web>
        <customErrors mode="Off"/>
        <compilation debug="true"></compilation>
    </system.web>
</configuration>

And I still get this:

enter image description here

I am beginning to think that maybe Visual Studio 2008 can not be used for Classic ASP. But that does not make any sense. It allows for the creation of a website in the menu. So it must generate a web.config file. I tried that path but I ran into some problems where it expected an existing website file prior to using the feature to create a web site.

xarzu
  • 8,657
  • 40
  • 108
  • 160
  • That’s a .Net config setting why you including it in a Classic ASP web application? – user692942 Sep 22 '21 at 21:01
  • Does this answer your question? [How do you debug classic ASP?](https://stackoverflow.com/questions/1138175/how-do-you-debug-classic-asp) – user692942 Sep 22 '21 at 21:02
  • 1
    Already explained to you once before that you cannot debug a Classic ASP site directly in Visual Studio, however you can use the "Attach to Process" to debug a IIS Website running a Classic ASP Web Application by attaching to the running `w3wp.exe` instance and setting breakpoints. – user692942 Sep 22 '21 at 21:05
  • @user692942 There is no w3wp.exe in the options when I use "attach to process" and I bring up the web site in a browser. Strangely, on the client's system, IIS and the code are on one server while the IDE is on another server connected via a network. It is a tangled mess. – xarzu Sep 22 '21 at 22:42
  • 1
    You need to use IIS (Add it if not installed in Add Windows Features) add a new Web Site and set the home directory to the root folder of your Classic ASP web application. If there is no `w3wp.exe` you've not setup your local development environment correctly. A Classic ASP site has to be hosted in a Web Server and the IIS is the Windows OS built in option. – user692942 Sep 22 '21 at 22:48
  • @user692942 yeah, you are right. It was tempting to run it after loading it as a web site in Visual Studio 2019 and since you can run it from there and it will load in a browser, it makes you think you can bypass the other step of attaching it as a process. I ditched trying to do it with 2008 because the client's network is a mess with source code existing on a different machine and setting up IIS to create a new site where the IDE is was a mess. – xarzu Sep 23 '21 at 00:12

1 Answers1

0

I have to wonder of people struggle with these issues, find answers online only to try them and fail, but get close. And then after some more struggles they discover the answer but it is so valuable that they do not want to share it online.

Here is the actual answer. Since I could not do what I was trying to do on the client's machine I was remoting into by VPN, I went back to what I have only local machine.

You can debug a classic ASP program in the latest version of Visual Studio 2019. All the blogs and all the google searches and, yes, even stackflow does not give you the complete answer. They will say you have to use this version or that version of IIS or or Windows 10 or any variety of Visual Studio IDE. But I have stumbled upon how to do it with the latest version of Visual Studio on Windows 10.

Here is how:

  1. Put the code you want to debug on a folder and set up IIS to run it.
  2. Then close IIS and open Visual Studio 2019
  3. If the Visual Studio 2019 Open Recent and Get Started dialog box comes up, click "Continue without code ->"
  4. Now here is the big secret no one tells you. You do not attack it as a process just yet. You click File->Open->Web Site
  5. From here, click on "Locak IIS" and then you will see your web site listed under "IIS Sites". Click on that and click on open 5 Now, do not run your program in debug mode just yet. If you do, you will be frustrated with not being able to put break points because it will say some cryptic message like symbols not loaded and/or you will find you can seem to set break points until you actually run the thing and then you find that the breakpoints are all disabled. So do not run the program eventhough it will be tempting
  6. Now, reopen IIS and click on your web site on under the "Connections' panel and opening up "Sites" Then on the "Actions" panel click on the link below "Browse Website". It will be something like "Browse *... (https)" with the ... being some port number you assigned. (all this is assuming you know how to set up IIS for your website already
  7. Then go back to Visual Studio 2019 and then attach to process for w3wp.exe

And then you can debug any classic ASP website in Visual Studio 2019

xarzu
  • 8,657
  • 40
  • 108
  • 160
  • You just need to have your web site setup and running in IIS, then attach to the running worker process `w3wp.exe`, as long as the process is attached the symbols will be loaded in and you’ll be able to set breakpoints. You may need to ["Enable server side debugging"](https://learn.microsoft.com/en-us/iis/configuration/system.webserver/asp/) in the ASP -> Debug section of the IIS properties which you can get to from clicking on the website in IIS. – user692942 Sep 23 '21 at 07:13
  • The OP did specify that he was using VS 2008, not 2019, so there's probably a reason he wants to use an old version. VS has changed a bit over the years. Up to at least VS2010 it didn't use IIS as a dev server by default ,it shipped with a lightweight server called Cassini which didn't support Classic ASP, only asp.net – John Sep 24 '21 at 00:12