Debugging WCF application with Visual Studio on AWS EC2 instance - c#

Local Debugging Fine
I would like to attach a Visual Studio debugger to my WCF application (w3wp.exe worker process).
I can do that successfully on my developement server where I have Visual Studio installed locally.
How to Debug on EC2?
Now I need to occasionally do that on my production server which is an Amazon Web Services EC2 instance.
With regards to remote debugging MSDN says: Debugging over the internet is not supported. - So is there no way to attach a debugger remotely to a WCF application running on an EC2 instance?
The only solution I know is that I have to install Visual Studio on the EC2 instance (time and disk space) as well as put the source code there, and then use local debugging? Hoping for an alternative and better solution?

Not a best practise but you could have one EC2 instance or EBS snapshot where Visual Studio is installed. Bring that up to debug effectively locally by RDP'ing into that server and then when you are finished you can swap back to the clean production server.

If installing VS is a problem, you can setup a VPN client and the Remote Tools (which is much smaller than VS install).
The idea is to setup a VPN between your machine and the EC2 instance, install Remote Tools (actually you might not even need to do that, just run msvsmon.exe) and connect using the VPN.
More info:
My blog post
remote debugger over internet

Related

How to attach a debugger to an application running on Windows Azure VM?

I have minimal experience with Windows Azure.
I got a VM running, connected to it using remote desktop, pasted my C# executable there.
Then, I installed the Visual Studio remote debugging tools, started it, configured it to allow on authenticated connections from any user, and configured an endpoint to the port it mentioned (4018).
But I can't seem to be able to hook visual studio to the instance. I tried entering the VM address:port but that didn't seem to work.
Is that even possible to do, or must the remote machine be on the same network and not over the internet? Is there any guide explaining the process? Most of what I found were relating to debugging an azure application, but nothing seemed to be about an arbitrary program.
Remote debugging with Visual Studio Remote Debugging tools is not supported through internet - http://msdn.microsoft.com/en-us/library/vstudio/bt727f1t.aspx
So you may have to switch to good old style of writing logs and analysing them.
You can do it. See 'How to debug an Azure Virtual Machine'.
http://msdn.microsoft.com/en-us/library/azure/ff683670.aspx#BK_Debugging_Cloud_Azure
That page also explains how to debug cloud services.
Also with the newer Azure tools versions, if you are running a cloud service, and you enabled the cloud service for debugging, you can actually first debug the cloud service, then you can easily switch to debugging your application by using the 'Debug -> Attach Process' menu item. (You have to set the 'Qualifier' in the dialog to that of the azure VM that you are debugging, then you should see all processes on the Azure VM show up in the attachable process list.)
Have you created a new cloud services for this VM so as to open that port to external? If not, any external clients won't be able to connect.
http://www.windowsazure.com/en-us/manage/windows/how-to-guides/setup-endpoints/
But you might consider install VS in another VM in Azure, as that can make things faster.

Visual Studio 2010 - Application not starting up through asp.NET Development Server but works on the Production Server

I am building a .NET 4.0 Web Forms application in C#. After working for around 4-5 months on this application, the other day when I went to 'Start' the application from Visual Studio 2010 and the application does not want to start. When trying to connect using telnet on the local host and that port, it connects, and after a while I get an error '400 - Bad Request'.
The funny thing is that when I Publish the application on another IIS server, it works fine, it seems like the problem is from the asp.NET Development Server. While I know that I can set-up a local IIS, I would prefer not to avoid doing this in order to avoid certain problems which might be related to having a different configuration of the local IIS from production.
I have checked the hosts file, re-installed visual studio and confirmed that the application works when published. I have also checked that the port is not being used by another process.
What else should I check?
If the application will not start, then the odds of you being able to connect to it via telnet on a port are 0. (It's not running.)
I am assuming the application can compile if you can publish it. Have you tried running the application without debugging? CTRL + F5

Visual Studio 2010 C# Run/Debug on Remote Machine

Please excuse my ignorance, I am mainly a Java developer and a bit unfamiliar with Visual Studio and the details of some of the debugging process.
I am creating an application (WPF and Console) in C# that is being developed on my workstation but I need to run/debug the application on another remote machine. Is there a way that I can just hit "Debug" from Visual Studio 2010 and have it emulate a run from the target machine? I need to do this because of local file directory access on the remote machine.
I have looked into remote debugging, but I think I am on the wrong track, as remote debugging just seems to use another machine to run the debugger, not the process itself.
Any information is greatly appreciated!
You will simply attach to process of the running application, for detailed explanation you should take a look at article
Remote Debugging with Visual Studio 2010
you cannot, but you can remote debug and attach to the app running on the remote machine, you will need the remote debugging tools installed on the remote machine
running (F5) on a remote machine, directly from within VS is possible in Dev11, however

Debug C# web service

I have a web service project and simple test application. I can debug the web service from Visual Studio 2008. However, there exist a real client application, but it is on another machine. ASP.NET Development Server does not allow connections if they are not from localhost, or so it seems. Is there a way to debug a web service, if client application is on another machine?
Edit
The tool that I used is Trace Utility from Microsoft SOAP Toolkit. Further explanation can be found here (works on XP; see continuation story for Windows 7 solution). There was problem with it though. My remote client fetches the WSDL first, and then creates URL based on values in soap tags found at the end of WSDL. So client gets redirected to localhost, which is not good.
I found my problem though, but I'll leave the question open until I find the time to try debugging via IIS.
Install a virtual directory into the IIS on your local machine. If you don't have IIS, install it. Once IIS is installed and configured on your local machine, you should be able to use either the IP or create a dns alias for that IP to access the web service that way.
I'm using SoapUI basic version to fake the SOAP requests to the web service, which is running in debug mode in Visual Studio, from the local computer.
You can use IIS (or Cassini Web server) - for debugging, attach VS 2008 to correct process (for example w3p.exe(IIS6 or greater) or aspnet_wp.exe(IIS 5)).

How do I setup IIS when debugging in Visual Studio 2010?

In Visual Studio 2010 I have created a WebService (WCF) Application and a client to consume said service.
My 3 options as far as what servers to use for debugging are: Visual Studio Development Server, Local IIS Web Server, Custom Web Server.
I know I can't use the VS Development Server if I want my service to be accessible outside of localhost. So I installed IIS (Control Panel>Add/Remove Programs>Add/Remove Features). When I select this option in Visual Studio 2010 it doesn't seem to work. I'm not sure what options I have to setup so that other machines can run the client to consume this service.
By default VS set the Project URL to: http://localhost/MyService. Oh, and I'm working with .svc files (not .asmx) if that makes any difference.
Common problem when you intall IIS after the framework.
Go to your Windows\Ms.Net\Framework\<version> folder and execute aspnet_regiis.exe. It's a commandline tool.
To save having to install IIS you can configure a proxy - such as Fiddler - to redirect certain incoming traffic to localhost.
Because these new requests are "appearing" (via the redirect) from inside your machine, Cassini will respond.
The process is covered in this answer: https://stackoverflow.com/a/4428747/1016183 under "Option #2: Write a FiddlerScript rule"
You can right click on Project and do publish. This will generate the required files for your deploy.
In order to debug your app, you can use the Visual Studio built-in host or IIS.
In your project properties, under Web, you can select "Use Local IIS Server".

Categories