Recently in the study of ASP. NET MVC source, so in the thought, since the source code, then how do we enter the source debugging? On the internet to find some debugging methods, try a few can not, so toss a morning, finally get out, below see my operation steps.
A: Prepare for work. This machine is installed vs2012, hit the update1 patch Pack,
Next download ASP. NET MVC, the address is: http://aspnetwebstack.codeplex.com/, after the download can be extracted.
Second: There are two ways to debug the source code, are: 1) directly under the source of the solution to create a new ASP. MVC4 Application 2) Create a separate ASP. NET MVC4 solution. I've tried both scenarios, but here I'm going to show Method 2.
Three: Modify the version number of the SYSTEM.WEB.MVC, compile.
We open as shown in the file and can see its latest version is 5.0.0.0
Here, we will change 5.0.0.0 to become a 4.0.0.1. This version number you can change to any value, the most important thing is to change the value of your correct fill in the Webconfig file.
Four: Modify the new MVC solution inside the webconfig version number, re-register the public key value.
Locate the Webconfig file in the root directory of the solution, such as operations.
The next step is to register the public key value with the command line tool vs2012, the command is: SN.EXE-VR *,31bf3856ad364e35
Seeing such a command is a sign of success. Change the value of this public key as shown above.
Five: Modify some version number in the View folder inside Webconfig
Six: referencing the corresponding DLL in the source code
Remove the following DLLs from the new solution first.
Referencing a new DLL
Seven: Here we can get the code.
Because ASP. NET MVC also uses a pipeline model, that is, the Mvchandler class handles the request and returns the result to the client through HttpModule. We add breakpoints in the Global.asax inside the Application_Start, adding breakpoints to the beginning of the Mvchandler class, such as.
Here, we have successfully entered the source debugging.
Eight: The episode, the root directory in the webconfig inside the node is modified as follows, or the page appears to be wrong.
According to the above changes, the Web page can be displayed normally.
Summary: The above approach is to create a new solution and then call the DLL. Then in the source code solution under a new project, the specific modification of the action as above.