VS2010 - Debugging a silverlight 4 OOB with breakpoints in the WCF services - visual-studio-2010

I created a silverlight 4 app , and chose to host it in a ASP.NET Web Application.
I added a Silverlight-enabled WCF Service to the Web Application Project.
The Web Application project is now set to be the startup project.
This way every thing works fine and I can stop at breakpoints in the WCF services in the Web app project, and also stop at breakpoints in the silvelight project.
In the silverlight project properties, I changed it to be an OOB. This causes the startup project to automatically jump to the silverlight project. OK, so now when I debug the silverlight app it's opened OOB, but now I cant put breakpoints in the WCF services in the Web app project (Although the silverlight client can communicate with the web app project) . So I changed the startup project to the Web app again. But now the silverlight app doesn't start as OOB.
How can i debug in the WCF services, and run it OOB at the same time ?
(My app is designed as an OOB, so it's important for me to develop it that way).

First, You have to set a breakpoint on your client side, right before you call a service operation.
Second, set another breakpoint inside the service method on the server side.
Now, when you start debugging and hit the first breakpoint, attach the dev server process to the debugger by doing the following steps:
click Debug - > Attach to process
select the Webdev process and click attach.
now when you continue to debug, you will be able to debug your service as well :)

When you start debugging, you should go into Visual Studio and manually attach the debugger to the development web server (Debug->Attach to Process...). This step is not done automatically when debugging OOB.

Related

Connect web app to Visual Studio Application Insights

I'm using Application Insights as part of my .Net Framework WebAPI project. When running the code locally (in debug mode), I can see all the events that would be sent to AI locally in Visual Studio by clicking the Application Insights button in the toolbar.
I've also got a Angular web App which works in tandem with the .Net backend. I've got the web version of Application Insights setup on it which sends telemetry to an Azure AI instance. Is it possible to have the Angular web app send its telemetry to the local AI instance in Visual Studio when I'm running it locally?
I'm using v2.5.10 of the #microsoft/applicationinsights-web library and Visual Studio Professional 2019 if that makes a difference.
Actually, there is no local AI instance. By default, the data you see in visual studio -> Application Insights Search window is from the current debug session, the screenshot is as below:
Another thing is that if you specify a valid InstrumentationKey, the data are always sending to application insights in azure portal(unless you setup firewall rule to block them).
For Angular web App, there is no way to just show the data in visual studio, but not sending to AI instance in azure.
Here are some suggestions just for your reference, but they cannot totally meet your requirement:
Solution 1: Sending data from Angular web App to AI instance in azure, then you can fetch these data from azure to visual studio locally. To do that, in the visual studio -> Application Insights Search window, change the Debug session telemetry to the AI instance in azure. Like below:
Solution 2: If you just don't want to send the data to Azure, you can use an invalid InstrumentationKey, and then open tools like fiddler to see these telemetry data.

How can I prevent VS2012 from running IIS Express for any debug?

I am running VS2012 (Ultimate version 11.0.51106.01 Update 01) and do have a website project along with some console, WPF and WCF server projects. My normal debugging runs a non website project and rarely do I debug the website project.
Any debugging however, always starts IIS Express. How can I prevent that? The website project "Web" tab forces me to select some web server and "IIS Express" is currently selected, but I don't want it to start unless I'm debugging the website. Seems like this started happening after some recent VS2012 maintenance as I don't remember it happening before about a few weeks ago. Now getting old.
Is this a VS2012 bug that any debugging fires up IIS Express?
Anyway to not start it when I debug a WPF or console app?

Silverlight OOB App and Web Service in same Solution

I'm using vs2012 and have created a Silverlight 5 out of browser application that talks to a MVC 4 webapi web service for its data.
With both projects in the same solution I can successfully fire up and test the silverlight application with the web service if I have the web service set as the startup project and have the application running in the browser and embedded in a view on the MVC web service site. If I set the silverlight application as the startup application so that I can run it out of the browser like the user will, then the MVC site doesn't get started and the web service isn't available to connect to.
Is there anyway to have both projects running in the same instance of visual studio, but have the silverlight app run out of browser?
Try this:
Right click on solution from Solutin Explorer and select Properties. Then select the Multiple startup project option inside Common Properties/Startup Project and set both as 'Start'. Close and Start Debug again.

Stop ASP.Net Development Server spinning up when using Azure Emulator

I am using The Azure Emulator for test deployment of an ASP.NET Web API application. When I run this I notice that the asp.net dev emulator also runs. As this does not seem to be needed, is there a way to stop it from spinning up?
There are couple of things to understand with Windows Azure ASP.NET Web role application:
When you have your Web Role set as "Startup Application" or you run ASP.NET web Role application only, you you will see the ASP.NET site runs at http:\localhost:XX this is because you are running your web application directly in IIS without any relationship with Azure Compute Emulator.
When you have your Windows Azure project set as "Startup Application" or you launch your Windows Azure application directly, in that case your ASP.NET web application will run within Windows Azure Compute Emulator. In this scenario the Compute Emulator will start if not running and if running then the ASP.NET web application will still run with IIS however due to virtual load balancer scenario you will see the ASP.NET web application is running at http://127.0.0.x:XX.
So depend on how you launch your project within your solution you will see different execution. When compute Emulator is running you can open its UI to understand how your different instances are running.
Finally based on your above requirement it seems you just want to test your application in IIS only so if you just set your ASP.NET web role to "startup project" you will not see compute emulator activity.

How to attach to and debug an ASP.NET MVC application running in Windows Azure Emulator?

I am writing an MVC 3 application to run in Windows Azure. On my local machine I use the Windows Azure emulator.
If I press F5 in my solution ("Start debugging") I'm able to put breakpoints and step through the code of my application.
Do you know if it's possible to attach to the application if it's already running (if it's been started with CTRL + F5, "Start without debugging")? If yes, how?
In ASP.NET running in IIS I just have to attach to the w3wp.exe process. How to do the same for the Windows Azure emulator?
If you are running the application in IIS (have a Sites section in your config file) then you will do it the same way with the emulator. Azure creates an Application Pool for the deployment so you will just need to attach to that w3wp.exe process.

Resources