简体   繁体   中英

Debugging previously compiled ASP.Net Web App without visual studio

So, I've had to rework a web app on one of our servers, a legacy app, that needed to get new branding via a common master page, where it previously had none. The page displays ok, but there's a form on it that calls a method in a compiled dll which allows the user to download a document. This throws an error, but the error is vague (mentioning a null reference). We have the source code but I don't have visual studio installed on my machine and even if I did we suspect it may have something to do with the server environment, and the server is not set up to run project files, just compiled web apps. One of my colleagues thought that by removing the dll, the app would just use the cs files and compile that at run time. That didn't work, and another colleague suggested turning debugging on in web.config, which we did, but still no go. He also mentioned that debugging required pdb files, but I don't see any in the source code we have. If I could get this working on the server just using the cs files vs. the dll, I could at least attempt to debug what's going on, any ideas on how to get that working?

There seems to be a good deal of confusion here about how ASP.NET applications work.

First, .CS files are meaningless to IIS. IIS knows about files containing markup. It also knows that the assemblies contained in the bin folder represent the server-side code that handles the incoming requests and generates the outbound responses.

In most cases, when a site is deployed to a production server, the .CS files are not included, because they are just noise on the server, useless file clutter that have no bearing whatsoever on the execution of the application.

Now, you're kind of lucky, because you have the source files there. You can, actually, force a recompilation of the cached assemblies. To do this, open the site's web.config file and add some whitespace (a single space) to the end of the first line. Then save the file. This will cause ASP.NET to clear its cache and rebuild the site.

This isn't guaranteed to get rid of your problem. Like you say, the problem could be somewhere else. What I would strongly suggest is that you download the site in its entirety, install Visual Studio (get a free express edition if you have to), and DEBUG the darned thing.

If you can't run it in a debugger and watch it execute, you're just guessing .

PS If this thing isn't under source code control, get it there, ASAP.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM