Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# DotNet在同一本地服务器上显示不同的端口_C#_.net - Fatal编程技术网

C# DotNet在同一本地服务器上显示不同的端口

C# DotNet在同一本地服务器上显示不同的端口,c#,.net,C#,.net,我不太熟悉dotnet,但需要对用它构建的应用程序进行一些更改。在应用程序的服务器上,我正在另一个端口(8050)上运行Python应用程序。如果我在服务器上,我转到Python应用程序,它会显示良好。我正试图通过用.net编写的应用程序来显示它的输出 我有这样一个文件: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="MyProjectDefault" %> &l

我不太熟悉dotnet,但需要对用它构建的应用程序进行一些更改。在应用程序的服务器上,我正在另一个端口(8050)上运行Python应用程序。如果我在服务器上,我转到Python应用程序,它会显示良好。我正试图通过用.net编写的应用程序来显示它的输出

我有这样一个文件:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="MyProjectDefault" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Test Layout</title>
        <style type="text/css">
            body, html
            {
                margin: 0; padding: 0; height: 100%; overflow: hidden;
            }

            #content
            {
                position:absolute; left: 0; right: 0; bottom: 0; top: 0px; 
            }
        </style>
    </head>
    <body>
        <div id="content">
            <iframe width="100%" height="100%" frameborder="0" src="127.0.0.1:8050" />
        </div>
    </body>
</html>
如果有任何改变会有所帮助


谢谢大家!

这行不通
.Net
与此无关。这是因为
iframe
是如何工作的。无论您将其托管在何处,
iframe
中的url始终是从客户机引用的。因此,任何打开应用程序的人实际上都在他们的机器上寻找
127.0.0.1:8050
,而这是不存在的。您只能从服务器本身查看,因为当时的目标
127.0.0.1:8050
是服务器本身

您需要使用公共域或至少使用指向托管python网站的机器的公共静态ip地址来托管应用程序。然后在iframe中使用该url


拥有一个
iframe
与打开浏览器并将url放入地址栏完全相同。

在,NET中,端口是动态的,因此每次。。。在项目中使用Visual Studio属性指定固定端口
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MyProjectDefault : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}