简体   繁体   English

使用 Amazon Web 服务 (EC2) 和 c# Windows 服务/WCF 进行远程调试

[英]Remote Debug with Amazon Web Services (EC2) and c# Windows Service/WCF

I have a Windows Server 2008 R2 in the Amazon EC2 cloud.我在 Amazon EC2 云中有一个 Windows Server 2008 R2。 I would love to be able to debug my C# Windows Service or WCF Service that is running on that server from my desktop in my office.我希望能够从我办公室的桌面调试在该服务器上运行的 C# Windows 服务或 WCF 服务。

In the past we got around it by installing Visual Studio on the server in the cloud, but we use remote debugging for our local servers, so I was hoping there was a way to make it work in the cloud.过去我们通过在云服务器上安装 Visual Studio 来解决这个问题,但是我们对本地服务器使用远程调试,所以我希望有一种方法可以让它在云中工作。

Has anyone out there accomplished remote debugging to the Amazon cloud without a VPC/Domain in the cloud?有没有人在没有云中的 VPC/域的情况下完成了对亚马逊云的远程调试?

Any suggestions or solutions would be most appreciated.任何建议或解决方案将不胜感激。

There isn't anything different about remote debugging against an EC2 instance than there is about remote debugging against a local server EXCEPT firewall configuration...针对 EC2 实例的远程调试与针对本地服务器的远程调试没有什么不同,除了防火墙配置......

I would recommend setting up a VPN connection to the EC2 server instead of opening up firewall ports (PPTP is quick and easy).我建议建立与 EC2 服务器的 VPN 连接,而不是打开防火墙端口(PPTP 既快速又简单)。

If you would rather open firewall ports I "think" you will at least need the following (untested):如果您宁愿打开防火墙端口,我“认为”您至少需要以下内容(未经测试):

TCP 139, TCP 445, UDP 137, UDP 138 (all related to DCOM) TCP 139, TCP 445, UDP 137, ZF5EF036B4D28 全部相关到DFBC63079Z118513

Another thing that always causes issues for me on EC2 instances is not passing the /hostname parameter to msvsmon.在 EC2 实例上总是给我带来问题的另一件事是没有将 /hostname 参数传递给 msvsmon。 msvsmon likes to default to the internal hostname and will startup showing something like "listening on 'ip-1-2-3-4.us-west-2.compute.internal", which means it will ignore attempts for connections from Visual Studio clients that think they are talking to 'ec2-7-8-9-0.us-west-2.compute.amazonaws.com'. msvsmon 喜欢默认为内部主机名,并会启动显示类似“正在侦听 'ip-1-2-3-4.us-west-2.compute.internal”的内容,这意味着它将忽略来自 Visual Studio 的连接尝试认为他们正在与“ec2-7-8-9-0.us-west-2.compute.amazonaws.com”交谈的客户。 To fix this, get the full public DNS name or public IP of your EC2 instance and then launch msvsmon.exe as:要解决此问题,请获取 EC2 实例的完整公共 DNS 名称或公共 IP,然后启动 msvsmon.exe:

msvsmon.exe /hostname ec2-7-8-9-0.us-west-2.compute.amazonaws.com

Then in Visual Studio:然后在 Visual Studio 中:

  1. Tools-->Attach To Process工具-->附加到进程
  2. Set Transport to "Default"将传输设置为“默认”
  3. Set the Qualifier to whatever you passed for a hostname when you launched msvsmon.exe将限定符设置为您在启动 msvsmon.exe 时为主机名传递的任何内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM