I have written an SharePoint EventReceiver (Windows SharePoint Services 3.0) and want to debug it with Visual Studio 2008 SP1, which runs on a different computer. I have tried the following steps:
Installing the event receiver (I know that this works because a log file proves that the code is executed).
Registering my event receiver class library in the GAC of the SharePoint server (built in Debug mode).
Starting Visual Studio Remote Debugging Monitor on SharePoint server.
Attaching to process w3wp.exe on SharePoint server from local machine.
Unfortunately Visual Studio tells me that the breakpoint I set will not be hit. I guess that when installing the assembly to the GAC the debug symbols (or whatever is needed for debugging) are lost.
What can I do to debug my event receiver? As far as I know the only way to extend SharePoint by custom assemblies is to deploy them to GAC - am I missing here something?
Best Regards
Oliver Hanappi
you could try manually copying your assembly's debug (.pdb) file to the c:\windows\assembly\MSIL\ASSEMBLYNAME\VERSION folder on the target machine and restart IIS.
I just ran into this issue this morning. I was getting the same error about breakpoints not being hit. In my case, it was because I attached to the wrong w3wp.exe process. If you have multiple w3wp.exe processes running on the server - make sure you're attaching to the correct process for debugging.
As an aside - you don't mention running iisreset anywhere in your steps. After you copy your custom event received assembly to the GAC - make sure you run an iisreset so that the web server is picking up your changes.
Hope that helps!!
This question is very old but I just want to share the following command that will assist in picking the right w3wp.exe process.
Assuming you have deployed and enabled your event receiver.
Execute this command on the commandline
%windir%\system32\inetsrv\appcmd.exe list wp
This will print the PID and an indication of which site it is for eg.
C:\Windows\system32>%windir%\system32\inetsrv\appcmd.exe list wp
WP "11632" (applicationPool:4a8cbf60637942ff9a2486d0e682ac54)
WP "16800" (applicationPool:SharePoint Central Administration v4)
WP "23648" (applicationPool:teams)
Now you can attach you Visual Studio debugger to the right process easily.
For example for the SP site teams I will attach to PID 23648
Related
I followed this tutorial to create a simple web job in Azure: https://learn.microsoft.com/en-us/azure/app-service/webjobs-sdk-get-started. The web job itself does its job, consumes the message in the queue and I see them appear in Application Insights.
However, I want to debug the function on my local machine by using the tools available in Visual Studio 2022.
I have published with following profile settings:
Next I've attached the debugger under het Hosting menu:
First thing I noticed is a message about no symbols being loaded when putting a breakpoint in the function:
When I add a message to my queue, it gets consumed by the web job but the breakpoint is never hit. I've been reading a lot of similar questions regarding a this issue but I'm not progressing any further.
In Azure Portal, I've enabled Remote debugging under Configuration > general settings
In Visual Studio 2022, I checked if the correct process is attached
Here I'm a bit confused thou, the connection target is connecting through port 4024, which is according to this document, the port for Visual Studio 2019. However, a connection target with port 4026 is not found.
What am I missing here? Am I forgetting another setting somewhere?
If have tried changing the stack setting .NET version from APS.NET V4.8 to NET 6 (LTS) but that didn't help.
Should the platform architecture match the architecture of my machine in order to get it to work? Or is this not linked in any way with the debugger?
Is there anything else that I should check or try? Because my hair is turning grey here :)
Apologies for the delay here!
It should be 4024 for both 32 and 64 bit.
See this Azure doc: Remote Debugger Ports on Microsoft Azure App Service
Typically, the error “The breakpoint will not currently be hit. No symbols have been loaded for this document.” -- This error message indicates we can start debug process and attach, but cannot set a breakpoint on any or some lines of code in the project.
Most, likely cause: Application is built without debug symbols or debug symbols are not available
Kindly try these steps:
Verify Debug Symbols are being used and published and in sync
Workaround the issue by disabling “Enable Just My Code” from the
Tools >> Options >> Debugging >> general menu in Visual Studio
Other things to narrow-down the issue:
Debug symbols must be available locally or deployed to the Azure App Service, and must match the local code you are trying to debug.
It is recommended to use Cloud Explorer over Server Explorer to
connect and debug which requires the Azure SDK.
You could optionally Manually Attach a Debugger to Azure Web Apps to troubleshoot this further or recommend this as a workaround.
(old blog, try similar steps)
Kindly verify the port (Visual Studio remote debugger port assignments ) required is open in the corporate firewall and on your local machine.
As a test, you may use tool like Wireshark/netmon, to see if the port successfully connects to the port (4024) needed by the process.
I want to run my ASP.NET 5 (beta7) application in Visual Studio 2015 on a specific domain, mydomain.com for example. How could it be achieved?
Hosting the published version would lose the Visual Studio debuging. Built in IISExpress launch profile do net let domain address change, just port number of localhost address.
EDIT: I've solved the problem with self-host, Microsoft.AspNet.Server.WebListener, but is there a way to do that with Windows IIS 8.5?
Publish your app to the file system and set up an IIS site as described in the documentation. You can use a custom domain if you override routing in the etc/hosts file.
In Visual Studio, go to Debug -> Attach to process
Check Show processes from all users
Find process called w3wp.exe and attach the debugger to it
Now your breakpoints will be hit as if hosted in IIS Express...
For me, I had to attach to the correct dnx.exe process not the w3wp.exe.
I found the correct dnx process by looking at the username it was running under. It was the app pool identity that I assigned the site to in IIS.
Update (2016-09-14):
With the release of .NET Core 1.0, I now must attach to a process that is named the same as my project. Eg. if my project is name TestWebApp then the process I attach to is named TestWebApp.exe.
We have a SharePoint farm configured with one SQL server, an Application server and one Web Front End. All assemblies run from the GAC on the WFE, except one. This one dll has to be forced (using gacutil) into the GAC on the App server in order to see changes in our SharePoint application.
My question is, what determines that this dll must run on the App server and not with the rest on the WFE? I assume because of this, I cannot debug in Visual Studio from the WFE. Do I have to install Visual Studio on the App server as well?
When setting up a timer job, it's possible to use the constructor to specify a specific server. That's likely how things got set up for this solution and associated .dll file. More info on that here:
http://www.martinhatch.com/2009/08/sharepoint-timer-jobs-and-multiple.html
As for adding Visual Studio to servers on your farm, if this is your production farm I do not recommend doing this. If you really need to debug in production (you really, really should have a development box set up for this), do it via remote debugging.
How can I tell which of my services is the one that I am trying to debug?
Using the Visual Studio 2010 debugger I would just look for the w3wp (or whatever the heck it was) that was running under the app pool username that my service was running under.
But now in my attach to processs window I have 3 msvmnon.exe processes and I don't see any wcf services running? What am I missing?
What I wasn't doing was checking the show processes from all users.
Set your WCF services project as startup in VS 2010. Then run the project, you will get a window with all services defined on the left side. Click on the service you wish to execute and pass parameters if any
I am trying debug a workflow code and it always shows that the breakpoint cannot be hit. I have made sure that I deploy the recent code.
Also I have tried to load the PDB symbols using windows->debug->modules but I don't see the dll of my project there.
I am not not understanding how to proceed further. I am using vs2010 and sharepoint 2010
In order to debug workflows you have to attach to owstimer.exe and w3wp.exe (try all of them if there a several). And of course you have to have the same code both in studio and deployed.