简体   繁体   English

如何在我的本地应用程序中启用远程访问 - IIS Windows 10

[英]How to enable remote access in my local application - IIS Windows 10

I have an application in my machine, and i can access it by localhost/myapplication normally, but I'm making a integration with a payment website, this website needs an url to send me notifications about the transaction status, I know if I had put my application online, it would access my notification url, but i need to debug it locally. 我的机器上有一个应用程序,我可以通过localhost / myapplication正常访问它,但是我正在与支付网站集成,这个网站需要一个网址给我发送有关交易状态的通知,我知道我有没有我的应用程序在线,它将访问我的通知URL,但我需要在本地调试它。 There is a way to enable access to my application even if staying in my machine? 有一种方法可以访问我的应用程序即使在我的机器上? I did lots of researchs of how to put IIS online but it just found threads that explain how do it only in same network that i am. 我做了很多关于如何将IIS放到网上的研究,但它只是发现线程解释了它是如何只在我所在的同一网络中进行的。 I am using windows 10 and IIS, builded on asp.net mvc and C# 我正在使用Windows 10和IIS,在asp.net mvc和C#上构建

The approach I would take at present is to download our free VS Extension called Conveyor https://visualstudiogallery.msdn.microsoft.com/a429dbb7-a982-4541-b401-934375c02c0f?redir=0 我目前采取的方法是下载我们的免费VS扩展名为Conveyor https://visualstudiogallery.msdn.microsoft.com/a429dbb7-a982-4541-b401-934375c02c0f?redir=0

It allows machines off localhost to connect to your IIS Express apps. 它允许localhost下的计算机连接到您的IIS Express应用程序。 At present that's not quite enough because you also need to connect to it over the internet. 目前还不够,因为你还需要通过互联网连接到它。 We're actually working on the feature to support that. 我们实际上正致力于支持这一功能。

If you have the ability to forward external ports to your machine, then you could do that. 如果您能够将外部端口转发到您的计算机,那么您可以这样做。 On a home network for example that's simply going in to your router, and setting up an arbitrary port to forward to your computer, so lets say forward port 50000 to your machine's IP and give it the port that Conveyor runs on (typically 45455). 例如,在家庭网络中,只需进入您的路由器,并设置一个任意端口转发到您的计算机,因此我们假设将端口50000转发到您的计算机的IP并为其提供运行Conveyor的端口(通常为45455)。

Then you can use your network's public IP and port 50000 to connect to your app. 然后,您可以使用网络的公共IP和端口50000连接到您的应用。

Eg. 例如。 on a home network your router might have the public IP 96.97.98.0 so you would use the address https://96.97.98.0:50000 from the payment system. 在家庭网络上,您的路由器可能具有公共IP 96.97.98.0,因此您将使用支付系统中的地址https://96.97.98.0:50000

I had a similar issue with IIS Express. 我有一个与IIS Express类似的问题。 I needed to access a local website from a virtual machine attached to my home network. 我需要从连接到家庭网络的虚拟机访问本地网站。

By default IIS Express listens to TCPv6 port. 默认情况下,IIS Express侦听TCPv6端口。 So I had to forward it to some TCPv4 port on my network interface. 所以我不得不将它转发到我的网络接口上的某个TCPv4端口。

For example, if your website runs at localhost:60000 and you want it to be accessible at 192.168.1.50:3000 you can do the following in administrative console or powershell under admin: 例如,如果您的网站运行在localhost:60000并且您希望它可以在192.168.1.50:3000访问,则可以在管理控制台或powershell下的powershell中执行以下操作:

PS C:\Windows\system32> netsh
netsh>interface
netsh interface>portproxy
netsh interface portproxy>add v4tov6 listenport=3000 connectaddress=[::1] connectport=60000

Now when you open http://localhost:3000/ or http://192.168.1.50:3000/ you should see your website that runs on 60000 port. 现在,当您打开http:// localhost:3000 /http://192.168.1.50:3000/时,您应该会看到您的网站在60000端口上运行。

Here is a blog post on this - http://programmingflow.com/2017/02/25/iis-express-on-external-ip.html 这是一篇博客文章 - http://programmingflow.com/2017/02/25/iis-express-on-external-ip.html

The solution is permanent, you don't need to repeat the configuration after restart, also it does not require any 3rd party software or changing your website's configuration. 该解决方案是永久性的,您无需在重新启动后重复配置,也不需要任何第三方软件或更改您的网站配置。

The only thing that might require some more tweaking is making sure your requests contain proper Host HTTP-header in them, otherwise IIS Express might reject them with 400 Bad request error. 唯一需要进行更多调整的方法是确保您的请求中包含正确的Host HTTP标头,否则IIS Express可能会拒绝400 Bad request错误。

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

相关问题 如何在没有 IIS 的情况下在 C# Windows 服务中启用远程通信? - How to enable remote communication in a C# Windows Service without IIS? 如何启用远程 Web 服务器中 IIS 中部署的 MVC 应用程序的远程调试 - How to enable remote debugging of an MVC application which was deployed in IIS in remote web server 如何从远程计算机访问 Windows 11 上的 IIS Express 站点 - How to access an IIS Express site on Windows 11 from a remote computer 如何在Windows 2012 Server中启用对Framework 4.0的远程访问? - How to enable remote access to framework 4.0 in windows 2012 server? IIS应用程序池访问网络上的远程目录 - IIS application pool access to remote directory on network 带有 Windows 身份验证的 IIS 网站无法在本地 Windows 10 计算机上运行 - IIS website with windows authentication does not run on local Windows 10 machine 如何在C#Windows应用程序上启用POS付款? - How to enable POS payment on my C# windows application? 如何在Windows Azure上的IIS 7上更改应用程序池的属性Enable32BitAppOnWin64? - How to change property Enable32BitAppOnWin64 of Application Pool on IIS 7 on Windows Azure? 从任何用户使用C#.NET应用程序访问Windows 10上的本地文件 - Access local file on Windows 10 with C#.NET application from any user 在本地 IIS windows 10 上托管 ASP CORE 2.1 - host ASP CORE 2.1 on local IIS windows 10
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM