sukesh
sukesh

Reputation: 2425

How to debug code in Sitecore

I would like to debug the Sitecore code just like asp.net code, but do not know how to.

The solution is outside wwwroot. Using Visual Studio 2013, IIS 10.0, Windows 10, Sitecore 8

Does attaching a process, is all I have to do to be able to debug.

In Visual Studio, when I click on Tools > Attach Process, there is no aspnet_wp.exe or w3wp.exe.

Is there any other process to follow.

Upvotes: 8

Views: 9194

Answers (5)

Chris Auer
Chris Auer

Reputation: 1445

I use Attach to Process in Sitecore rocks.

enter image description here

Sitecore Rocks can be found in the Visual Studio Marketplace via the Tools | Extensions and Updates option in visual studio. Search for Sitecore Rocks in the Online folder.

Upvotes: 5

Swapnil Mishra
Swapnil Mishra

Reputation: 1

You can do one thing in this case. Go in Visual Studio to Debug > Attach to process....

Now you'll see a window containing available processes. We need to connect to IIS , hence mark the checkbox saying Show processes from all users. Once you do that, you'll find a process w3wp.exe. Jut select it and click Attach.

Upvotes: 0

Steven Zhao
Steven Zhao

Reputation: 101

If you want to attach to w3wp.exe you have to make sure the website is running in IIS under its own app pool with its own domain binded as well as host file updated to associate that domain with localhost 127.0.0.1. If you need more help, along with simplified detailed instructions, please reach out to me.

Upvotes: 0

Hishaam Namooya
Hishaam Namooya

Reputation: 1081

You can use dotpeek to debug the Sitecore Code.

Steps to debug Sitecore Code:

  1. Download and Install Dotpeek.
  2. Open dotPeek and click on StartSymbolServer default dotPeek uses port 33417.

  3. Open Visual Studio options

  4. In Debugging/Symbols tab click on add new symbol files location and enter http://localhost:33417 (or the port that you assigned in the previous step)

  5. In VS options go to Debugging/General and uncheck “Enable Just My Code” option if it is checked

  6. In dotPeek click on open icon that will show a dialog for loading an assembly

  7. After the assembly is loaded right click on it and click generate pdb. In the appeared window choose the namespaces that you need to debug (or each one as I did) and click Generate Now we are ready for debugging

  8. Open VS and attach to the sitecore process (loading symbols may take longer than usual)

More info: http://bilyukov.com/debugging-sitecore-dotpeek/

Note: You can also export the Sitecore dll to a VS Solution in dotpeek along with its pdb file, then follow the above steps to configure your VS. You need to attach to the Process of the exported Sitecore Solution.

Upvotes: 9

Vlad Iobagiu
Vlad Iobagiu

Reputation: 4118

When you try Debug > Attach to Proces please make sure your site is running. Please also check if "Show Process from all users" is checked. See below picture:

enter image description here

Upvotes: 13

Related Questions