views:

519

answers:

11

Usually, we install VS.NET on our production server, to solve problems easily with our product, if necessary.

Is this a good or bad idea?

+1  A: 

Both. One of the upsides is that it can sometimes make diagnosing problems easier. One of the downsides is that sometimes the install can break a working web application. I would only do it if I had to.

Edit: another potential downside to this occurs when a co-worker decides to debug a live process on the production server, stops the app on a breakpoint, and then goes to bed without realizing he has left the app unavailable. Yes, this has happened to me.

MusiGenesis
+7  A: 

Debugging and development should be done in a "safe" environment - something that is not mission critical. For example, you should have a development and/or QA server that you use for development and debugging.

EDIT: Your QA server should mirror your production server, so that you are able to debug in an environment similar, if not identical, to your production environment.

Kyle Trauberman
I think the "if not identical" is critical, here. Bugs that occur on only one server are not uncommon in my world, for reasons that are fundamentally out of my control. If my choices are using VS or wishing I could reproduce the bug on the QA server, I'm going with VS.
MusiGenesis
But VS is not your only debugger. See some of the answers from other people on alternatives to have Visual Studio on the server.
BrianLy
You can still debug code running on a production server without installing visual studio on the server. Check out the Remote Debugger (http://msdn.microsoft.com/en-us/library/bt727f1t.aspx)
Kyle Trauberman
I can't use Remote Debugger on my production server. I can only RDC in to the server and run stuff there. I could maybe install and run some other debugger on the server, but why? BTW, so far I haven't ever had to debug on this prod server, so I have not installed VS there.
MusiGenesis
My point is that obviously you do not want to install and run VS on your production server. But if you have to (and sometimes you do in the real world), glance around furtively and then go ahead and do it.
MusiGenesis
Yes, obviously, there are some exceptions, but generally, as a rule, VS on a production machine is a big no-no.
Kyle Trauberman
A: 

Depends on how you're using it. Most of the heavy work that it's designed for shouldn't be necessary on a production server. I usually install Notepad++ on the production server for editing xml, config files, etc. I'd say if you want to install VS, go for it.

Shawn Simon
I think he's talking about using it for debugging. Notepad++ isn't very good at that.
MusiGenesis
+2  A: 

The recommended way is to have a mirror of production server for testing/debugging purposes. To keep the mirror current you need to install all application updates on both servers at the same time and backup/restore production database on mirror nightly or on demand.

There are still some downsides like error that only happens under a heavy load. In this case you need some kind of logging to trace errors. Also you might need to purchase an additional license of third-party components to install on production mirror.

Sergey Kornilov
+1  A: 

I would never do anything directly on the production server that would require Visual Studio. It's too risky to make a change on production that doesn't make it back into the code base and thus into version control. Eventually, you'll end up reintroducing a bug that you thought you had solved because you only changed it on the production server. Occasionally I will update mark up or XML files on the production server but only after having made the change in development and tested it on the QA box, and only when no actual code is involved.

tvanfosson
A: 

Of course it depends on the product and what you're debugging. Generally speaking you should try to avoid it, but there are some cases where you can't exactly duplicate a scenario on a testing server and it might be useful to attach a debugger to a running process to quickly narrow down a problem. i.e. if you're running a MMORPG server, and there's an intermittent bug that occurs under certain load conditions, you can spend weeks or months trying to figure it out from log files and/or simulated connections on a testing server, or you can attach a debugger while the problem is occurring in realtime on the production server, and figure it out in an hour.

I would tend to treat this as an exceptional case though, and do as much debugging off of the production server as is possible and reasonable.

Gerald
+2  A: 

I would not think this is a good idea. Your code should have sufficient logging so that if there is an issue in production you can go back through the logs and determine what has happened and fix it in a development environment, then test it in a staging/uat environment before being pushed to production.

At the place I work developers are not allowed access to any production environment, that is handled by the server/network teams but that is because it is a large business. For smaller firms the developers will have access but it doesn't mean you should use it for debuging.

Chris Aitchison
+1  A: 

Have a look at Sasha Goldshtein's Production Debugging series on his blog. He has some great walkthroughs and screencasts about what can be done to debug without Visual Studio.

hmemcpy
+2  A: 

It really depends on whether you accept the risk that the installation brings with it:

  • Hanging of production applications when someone attaches a debugger to the wrong application.
  • It breaks with what is considered best practice, so what practice are you going to break with next? In the worst case people are going to be starting to do development tasks on production
  • Potential problems with getting support, I would check with Microsoft if IIS and SQL Server etc are supported in a production environment where VS is installed.

You should also ask yourself what is most difficult with debugging the issue without VS on the server:

  • Are you familiar with stack traces and how to read them?
  • Do you know how to run a debug mode version of an application versus a release/free build?
  • Did you know that you can use the SOS debugger extension to .NET applications with the Windows Debugging Tools?
  • Have you considered using tools to automatically collect and report on server crashes?
  • What are you doing to prevent problems occurring in production. Can you do some sort of static analysis, re-design modules based on problems, or use a technique like test-driven development?
BrianLy
+3  A: 

That is definitely not acceptable. First of all, for debugging you can always use the debugging tools for windows/windbg. Supports .NET debugging as well (SOS / son of strike), and with a cheat sheet is not that hard to use. Windbg can run from a USB stick without installation.

Second, and the most major cause: whenever you install any of the newer versions of VS, it registers its debugger for interactive mode** - you get a message box when an exception occurs. You need to manually edit the registry to revert back to default behavior after the installation - and nobody ever remembers that.

Don't do it. There are better ways for diagnosing issues.

Woah... what is this? :) How do I stop that from happening, I've never seen that, and I do have VS.NET installed in production now.
Jason
A: 

It is generally considered not to be a "Best Practice" to install Visual Studio on production servers. This may introduce security risks - but one big concern I would have is performance. Visual Studio uses a tremendous amount of resources and running your debuging there can significantly impact perforance of production applications.

fuzzbone