0

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?

2
  • You need to get this running locally - if you're going to support it and change it, eventually you're going to need studio. If the site has been pre-compiled, then the .cs files will never be used. Commented Oct 22, 2013 at 14:32
  • @Paddy, what is actually instructing the app not to use the .cs files if there is no project file or dll on the server? There's no IIS setting or setting in web.config that does this, right? So what determines whether or not the app will compile at run time or not?? Commented Oct 22, 2013 at 14:47

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Yeah, I did try editing web.config and that didn't seem to help. I'm passing it onto someone who has visual studio. Unfortunately this is a somewhat locked-down environment, and so I can't just installe VS Express, or anything else. Hoping that a license will come through eventually. We also don't have source control for this particular app because, well, it's not even one we normally work on - it's one that's been handed to me because the folks who normally work on it are "too busy" to bother with it right now...
@Levi, I'm not sure which version if IIS you're using, but did you try resetting the application pool after you touched the web.config? If your version of IIS doesn't support Application Pools, you could stop and start the site. Ugly, brutal, and a blunt-force approach (especially if the site maintains session state), but it may solve the problem.
@MikeHofer, I just had one of our guys reset the app pool for the site and it is still throwing the error, so no go. :( Doesn't seem to want to use the codebehind at all, just a compiled dll...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.