[英]Visual Studio runs on local machine with server's IP
I need a small direction for below task.我需要一个小方向来完成以下任务。
We are consuming APIs for getting some values.我们正在使用 API 来获取一些值。 The company who written APIs, allows only our server IP for making request.编写 API 的公司只允许我们的服务器 IP 发出请求。 (Basically, I cannot make API calls with my local machine.) I did the develop on visual studio and now need to test that the code is working fine or not. (基本上,我无法使用本地机器进行 API 调用。)我在 Visual Studio 上进行了开发,现在需要测试代码是否正常工作。 If I deploy the project on the server seems to be ok.如果我在服务器上部署项目似乎没问题。 But if there is an error in the code, then I need to do the changes and deploy it again and again.但是如果代码中有错误,那么我需要进行更改并一次又一次地部署它。 That is bit horrible.这有点可怕。 Also I won't be able to debug.我也无法调试。
What my question is, how to run Visual studio in my local machine and particular API call goes with server?我的问题是,如何在我的本地机器上运行 Visual Studio,并且特定的 API 调用与服务器一起使用? What is the easiest way to do this?最简单的方法是什么? Any expert can show me at least a direction, since I never done a task like before.任何专家都可以至少给我一个方向,因为我从来没有像以前那样完成过任务。
Additional Info.附加信息。
I can suggest several directions我可以建议几个方向
To remote-debug a .NET application on a linux/unix server, do the following:要在 linux/unix 服务器上远程调试 .NET 应用程序,请执行以下操作:
Start your process (ie dotnet myApp.dll) on the remote server.在远程服务器上启动您的进程(即 dotnet myApp.dll)。
Then, in Visual Studio, use Debug->Attach to process.然后,在 Visual Studio 中,使用 Debug->Attach to process。 Select SSH as transport, and enter "username@IP" in the address box (ie "me@192.168.1.43"). Select SSH 作为传输,在地址框中输入“用户名@IP”(即“me@192.168.1.43”)。 Now a dialog opens where you can specify some connection details.现在将打开一个对话框,您可以在其中指定一些连接详细信息。 When everything works, you will be presented with the process list on your server.当一切正常时,您将看到服务器上的进程列表。 (Note: This works only if your process does not run as root, otherwise you have to use "root@IP" and previously set a SSH password for root). (注意:这仅在您的进程不以 root 身份运行时才有效,否则您必须使用“root@IP”并且之前为 root 设置了 SSH 密码)。
As @Serg notes, there might be an automatic deploy mechanism available, but otherwise you can use a tool such as WinSCP to automatically synchronize your build output with the server.正如@Serg 所指出的,可能有一个自动部署机制可用,但是您可以使用诸如 WinSCP 之类的工具来自动将您的构建 output 与服务器同步。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.