Attach debugger to ASMX service on Azure app service - azure

I have an old service that we have deployed up into Azure using an App Service (type: Web App). I publish this asmx direct from Visual Studio 2015 Professional. It works really well accept I cannot attach the VS 2015 Pro debugger to an instance of my ASMX.
I have set everything up correctly (so I think) in Azure and I am deploying with a Debug configuration:
But when I attach the debugger from VS - no errors are shown, it appears successful up until I set a new breakpoint, I get this (I have confirmed that I am attached to w3wp.exe):
I get a "hollow" breakpoint and the error:
The breakpoint will not currently be hit. No symbols have been loaded
for this document.
I get what this error is, what I don't get is how can I successfully attach the debugger to an ASMX service on azure?
Is attaching a debugger to ASMX on azure not supported?

Figured it out. Despite everything looking like it was attached, it wasn't. I had to go to Debug > Attach to Process > and specify the website.
Using the remote debugging option on both Cloud Explorer and Server Explorer does not work in my scenario.
For a better walk through:
https://msdn.microsoft.com/en-us/library/dd434211(v=vs.100).aspx
The real issue:
Azure does not play nice with < .net 4
After upgrading the package to 4.5.2 I could do the following:
Attach the debugger from VS
Use the ConfigurationManager class to get application settings and connections strings from Azure
Plus a few other basic Azure features.
Bottom-line, update .net before publishing

Related

Visual Studio 2022 Debug On Remote Azure Server

I appears that the Cloud Explorer has now been retired in Visual Studio 2022.
This was something that I used many time a day and will sorely be missed.
I used to be able in the Cloud Explorer select the app service, right click, and attach the debugger to the app. In Visual Studio 2022 I can find no way of attaching the debugger the the remote Azure app service. Also browsing the web I can't find any documentation on how to do this. Can someone supply directions on how to do this, or point me to the documentation on how to debug an Azure app on the remote server.
Currently there's an option to debug Azure App Service.
Instead of using the cloud explorer you may create a publish profile and attach a debugger from there:
All in VS 2022.
I’ve had the same problem, trying to do remote debug an App Service with VS2022. I just realised that the top dropdown box “Connection Type” on Debug | Attach to Process... dialog gives you an option “Microsoft Azure App Services” (I'm using ver 17.2.4). Clicking the Find button lets you select target App Service. You can then select the target process. (Attaching from the Publish dialog doesn’t let you select the process - you may have a number of apps on virtual directories).
One thing I noticed and confusing; the listening port is not 4026 but 4024 even though you specify VS2022 on the Azure Portal in my case. Telnet or Psping to 4026 – no response. If you do the above way, this doesn’t matter but if you select Connection Type: “Default” and specify host:port, then the port should be 4024. You can remotely debug Azure Function in this way.
Today with Visual Studio 2022 you can use the Connected Services node under a given project:
Once you connect to an app service, you'll have access to attach the debugger:
Microsoft Learn Module
Remotely debug ASP.NET Core apps hosted on Azure App Service using Visual Studio
More info here:
Manage the resources associated with your Azure accounts in Visual Studio Cloud Explorer
Overview: Connected Service

Unable to attach debugger from VS 2017 to Azure App Service for Web App Bot

I have deployed my Bot Framework v4 app as a Web App Bot to Azure. I can connect to it in Web Chat in the Azure Portal, but it is crashing when I message it via Twilio.
I am attempting to debug this, but when I try to attach via Visual Studio's Cloud Explorer I get the error in the screenshot. I have also tried attaching directly by using the username and password in my publish profile, but that always results in the breakpoints saying the symbols haven't been loaded once it is connected. When I look at the debug modules, I don't see any pertaining to my bot's dll. This is with the publish profile set to the Debug configuration, so no issue with optimized code.
Any suggestions are greatly appreciated!
I have seen this error during one of my attempts. I ended up removing the current version of code from the web app by using the Kudu Console, restarting the app service and then publish again from VS using the publish profile.
Was able to make some progress on debugging by attaching to SITENAME.scm.azurewebsites.net instead of SITENAME.azurewebsites.net.
Doesn't explain why Cloud Explorer still can't connect, but at least unblocks me for now

Azure endpoint reached, but calls to API returning 404 error

We have set up an app service project in the Azure Portal and then went through deployment of the project using Visual Studio DevOps. When I go to http://MyAzureSite.azurewebsites.net (Made up URL here), I can confirm that the service is up and running.
But when I add "api/ControllerName/getStatus", I get a 404 error.
Call from my local machine is working perfectly fine.
http://localhost:52686/api/status/getStatus
But not:
http://MyAzureSite.azurewebsites.net/api/status/getstatus
Signature for the GetStatus looks good:
[HttpGet]
public List<Status> GetStatus()
We had the same exact problem with the most recent .NET Core 3.1 LTS release. We found multiple things that can cause this problem. Here are our findings:
API endpoints should extend ControllerBase instead of Controller:
ControllerBase creates a controller WITHOUT view support. Controller is for view support. We had an API endpoint that couldn't be reached when deployed in Azure if it was extending Controller and it didn't have a view. No errors or anything. Just couldn't reach it.
Make sure the App Service is configured for the correct stack. Our web API uses .NET Core 3.1. If you create it from Visual Studio, it may be configured for the incorrect stack. Our Visual Studio 2019 configured it for 3.0 EOL by default. When we changed it to 3.1, things worked again.
Creating from Azure Portal doesn't work with default configuration.
If you create the App Service / Web App through the Azure Portal, you won't be able to reach any of the endpoints at first. We are not sure why this is, but we figured out how to make it work again. Go to the configuration for the App Service and follow these steps:
Turn Off "Always On"
Save and wait for settings to apply
Turn On "Always On"
Save and wait for settings to apply
Now you should be able to hit your API endpoints again
These were a few problems that we had and the solutions to them. Hopefully, they help you guys out and save you from days of going "We fixed it!" just to have it stop working again for another unknown reason. I'll update this answer as I find more things that break APIs and App Services and as I find solutions to them.
We had to rebuild the project properly again, its the way project was created that was incorreect.

Hook up visual studio profiler to Azure Service Instance

i am not sure if this is the correct place to put of this question as this has nothing to do with coding but rather configuration. My apologies.
I want to hook up my visual studio 2012 profiler to a azure service WaWorkerHost.exe which is hosted on Windows Azure.
After much searching i found Profiling Cloud Service. But this shows only how to profile WaWorkerHost.exe which is currently running on localhost i.e. on Azure Simulator rather than on actual Cloud.
Any help will be appreciated.
Thank you
Not sure if this is something you're looking for, but you can enable profiling when you publish your cloud service through Visual Studio.
and here's a link which talks more about it: http://msdn.microsoft.com/library/hh369930.aspx.

How to use IntelliTrace in Azure Development Fabric?

When I create a new Azure solution (with a web role and a worker role), add a line of code to the Default.aspx.cs file, put a breakpoint there, and launch debugging in the Development Fabric, when the breakpoint is hit and I look at the Intellitrace tab, I am confronted with the following error message:
Intellitrace is not collecting data for this debugging session. The project type may not be supported or the process you are debugging may have been either attached to or launched with IntelliTrace disabled. Restarting the debugging session within Visual Studio may solve this. Please note that IntelliTrace is not supported when attaching to a process that is already running. If you have selected a custom location for InteliTrace [sic] recordings, please make sure it is writable by the process being debugged.
The problem also occurs with other Azure solutions that I previously created. When I create a standard ASP .Net web application, I am able to use IntelliTrace without difficulty. I have tried this both without selecting a custom location for IntelliTrace recordings and using the same location that I used for a standard ASP .Net web application. I tried restarting the computer too. I also reinstalled the Windows Azure SDK. Because of concern that IntelliTrace might not work when SQL Server Debugging is enabled, I made sure that SQL Server Debugging was disabled on the worker role (the only project that had an option for this in the Debug tag of the project settings).
The closest resource on this question is on the MSDN forums. The answer is unclear. It states, "For locally, you can enable IntelliTrace, but you would have to add the add-in by hand." What add in, and what does it mean to add the add-in by hand? The answer there also refers to this blog post, but that discusses only how to enable IntelliTrace for applications that have already been deployed to the Windows Azure cloud and does not address using IntelliTrace in the Development Fabric.
Intellitrace doesn't work against the local dev fabric. You have to deploy your application to get Intellitrace to work. More about debugging Azure apps here.

Resources