6

I had a piece of code that was working perfectly on my dev server, but once I deployed to my test server it stopped. I've dug through the logs and haven't found anything useful.

I was wondering if there is a way to attach to the process on my test server from my dev box (where I have Visual Studio installed).

Is this possible?

2 Answers 2

2

You can remotely debug SharePoint solutions just like any .NET solution. I've blogged about it SharePoint Remote Debugging, the main points are that:

  1. You are running Visual Sudio Remote Debugger (msvsmon.exe)
  2. You are using an account with permissions to debug.
  3. You have placed the pdb files in the approriate folder (usually in GAC)
  4. The version of code running on the remote server is exactly the same as in the Visual Studio project you have opened (If possible it is always good to perform fresh build and deployment before trying to debug.

Also for a more detailed guide on how to do it read Remote Debugging SharePoint 2010 Solutions. In particular for the remote debugging components you just need to copy them from a machine with Visual Studio:

Get Remote Debugging Bits Set up Pull the remote debugger folder from your VS2010 install at: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger over to the remote server. Note there is a 64 bit and a 32 bit version. Choose the correct one.

Make sure that the account that you use on your local machine also exists on the remote machine. They do not need to be in the same domain, but they must have the same name. Add the account to the appropriate group on the remote machine (administrators?).

Start the remote debugger “service” by double clicking on msvsmon.

Back on your local machine in VS2010, go to debug>attach to process and enter the domain, account and server that you are connecting to. NOTE that the account name is not necessarily your user account (ie the account you ensured exists on the remote machine above). It must be the account the THE REMOTE DEBUGGER IS RUNNING UNDER.

1

You can use VS Remote Debugging, however you will need a copy of Visual Studio installed on the SharePoint server. You can setup remote debugging as in normal ASP.NET apps (http://msdn.microsoft.com/en-us/library/bt727f1t.aspx).

To minimise this requirement in the future (or rebuild/deploy if you can and are still having trouble), I recommend having lots and lots of tracing, and using settings to control how much is written to logs. Then you can trace your app when you want to, and use relevant logs to identify issues. This is always very important for web applications in SharePoint and ASP.NET.

5
  • Just to be clear, when you say: you will need a copy of Visual Studio installed on the SharePoint server. The "SharePoint server" you are talking about is my Dev server and not my test server? Dec 21, 2011 at 23:21
  • No I am talking about your test server - teh debugging components have to be on the destination (in this case test) server. If you try to run the components remotely, you will likely run into problems with 32bit and 64bit issues (and others).
    – Russell
    Dec 21, 2011 at 23:24
  • 3
    You do not have to install visual studio on the remote server, Remote Debugger can be installed independently of Visual Studio.
    – Ryan
    Dec 22, 2011 at 10:06
  • Remote debugger is a component that comes with visual studio...
    – Russell
    Dec 22, 2011 at 10:27
  • 3
    Yes, but its a separate install. You dont have to install the full visual studio to install remote debugging monitor. Its meant for exactly this sort of scenario - debugging something running on a server without having to install VS on the server.
    – Ryan
    Dec 22, 2011 at 16:02

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.