简体   繁体   English

将网站托管在MVC / IIS的另一台本地计算机上?

[英]Embed a website hosted on another local machine in MVC/IIS?

I have a 3D printer which has a web interface that I can access locally (and indeed externally if I portforward to it). 我有一台3D打印机,该打印机具有一个Web界面,可以在本地访问该Web界面(如果我移植到它,也可以从外部访问)。 The problem is that port 80 is forwarded to my IIS webserver and I need to keep it that way. 问题在于端口80已转发到我的IIS Web服务器,我需要保持这种方式。

I want to access the printer on port 80. 我想通过端口80访问打印机。

My question is, can I embed the 3D printer website in another website that I can then host on my IIS server? 我的问题是,我可以将3D打印机网站嵌入另一个可以在IIS服务器上托管的网站吗?

I have tried using iFrames as follows but it doesn't work externally. 我曾尝试如下使用iFrame,但是它在外部无法正常工作。

<iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms"
src="http://192.168.1.187:80"
style="border: 0; width:100%; height:100%;">
</iframe>

I'm guessing I'll need to pre-render the webpage locally before sending it to the client? 我猜我需要在本地预渲染网页,然后再将其发送给客户端?

Please note, the 3D printer site NEEDS to be hosted on the 3D printer machine. 请注意,3D打印机站点需要在3D打印机计算机上托管。 I can't move it to IIS. 我无法将其移至IIS。

You could use the php get_file_contents function ( http://php.net/manual/en/function.file-get-contents.php ) (or the equivalent function in your server-side language of choice) and pass in a URL to the function. 您可以使用php get_file_contents函数( http://php.net/manual/en/function.file-get-contents.php )(或选择的服务器端语言中的等效函数)并将URL传递给功能。

If there are only a small number of pages in the 3D printer site, you could just have one php page per printer site page, each php page basically forwarding on the contents of the associated printer website page. 如果3D打印机站点中的页面数量很少,则每个打印机站点页面可能只有一个php页面,每个php页面基本上都在关联的打印机网站页面的内容上进行转发。

If there are a lot of pages, you might want to work out some kind of scheme or convention to map between the two sites and just use a single php page that takes the URL segments or query string params passed in and maps them to your 3D printer website pages. 如果页面很多,您可能需要制定某种方案或约定以在两个站点之间进行映射,而只使用单个php页面,该页面接受URL段或查询传入的字符串参数并将它们映射到您的3D打印机网站页面。

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

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