【发布时间】:2020-01-13 07:55:58
【问题描述】:
我对 dotnet 不是很熟悉,但需要对使用它构建的应用程序进行一些更改。在应用程序的服务器上,我在不同的端口 (8050) 上运行 Python 应用程序。如果我在服务器中并转到http://127.0.0.1:8050,则 Python 应用程序显示正常。我正在尝试通过用 dot 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>
这不起作用,并且 iframe 不是正确的方法,但这大致是我希望发生的事情。我希望 dot 网页呈现端口 8050 上显示的内容。有什么办法可以做到这一点?
Default.aspx.cs 页面看起来也很简单:
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)
{
}
}
如果有任何改变会有帮助。
谢谢!
【问题讨论】:
-
在,NET中,端口是动态的,所以每次都得到一个端口……在项目中使用Visual Studio属性指定固定端口stackoverflow.com/a/21202917/28004