Digivation Hack Central

Tag: remote

Debugging shared Client/ASP Web Service projects in VS2010

by on May.19, 2011, under Windows

This post details the setup required for combined Remote Debugging server side web services with client programs in the same project. It is here mainly to assist my memory but may be of use to others as I had to dig for a lot of this info.

It assumes you log into the local development machine as a domain user and the remote IIS server is on a different domain with no shared trust.

This applies to VS2010 but should also be relevant to vs2008 and vs2005.

Local Computer Config

You will have logged on the local computer as MAINDOMAIN\user

  • Create a local computer user with the same name and password as your domain one. ( This step may be unnecessary )
  • Change the Sharing and Security Model In Local Security Policy/Local Policies/Network access: Sharing and security model for local accounts
    set Classic – local users authenticate as themselves

Remote IIS Computer

  • Create a local computer user with your domain user name and same password.
  • Add Administrators group to this user.
  • make sure msdeploy works.
  • Add debug rights to new user In Local Security Policy/Local Policies/User Rights Assignment/Debug programs/Add User or Group
  • Change the Sharing and Security Model In Local Security Policy/Local Policies/Network access: Sharing and security model for local accounts
    set Classic – local users authenticate as themselves

msvsmon config

Create a batch file to run msvsmon called runmsvsmon.bat in the base path (e.g. wwwroot\ServiceTest) of the asp service as follows

SET _NT_SYMBOL_PATH=%CD%\bin
cd "C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger\x86"
start msvsmon.exe

Run the batch file as the user added above.

This will allow symbols to be used during step into service debugging.

Change the server name in msvsmon to

DEVDOMAIN\user@LOCALMACHINENAME

This allows your user to attach juts by entering the remote ip address (domain search for remote server is disabled in this case) in the Qualifier field in VS and thus works for standard debugging too.

Visual Studio Config

In Debugger Options

  • disable Enable just my code
  • enable Enable source server support

In Web Service project properties

  • Web/Use Custom Web Server/Url – http://remoteip/ServiceTest
  • Package/Publish Web/IIS Web Site – Default Web Site/ServiceTest

In Publish Service

  • username user
  • password is whatever
  • save password checked
  • method WebDeploy
  • URL http://remoteipaddr
  • Site Default Web Site/ServerTest or Default Web Site/Server
  • check Mark as IIS app
  • check Leave extra files

Procedure

Deploy Web service first

This should succeed if msdeploy is working on the remote server.
You should see the files update on the target.
add debug=”true” to compilation tag in web.config.

  <compilation debug="true" targetFramework="4.0">
  </compilation>

Test Tools/Process Attach

If you get a list of processes, you have everything should be working.

Debug Client and Web Service together

Set a breakpoint inside the service module and press F5. It should then break with source.

Set a breakpoint in the desktop client and step into a web method.

Comments Off :, , , , , , , more...