【问题标题】:Deploying ASP.net Online (Issue)在线部署 ASP.net(问题)
【发布时间】:2017-10-22 04:45:29
【问题描述】:

问题:

我正在尝试将我的 ASP.net 项目文件上传到 FTP(第一次),但是当我加载我的网站时,后面的代码没有运行。

项目:

我构建了一个简单的测试项目,其中包含一个 index.html 文件和一个 index.aspx 页面。 ASP 索引页面有runat="server",以便在访问网站时可以立即运行。在 Page_Load 方法后面的代码中,我让它在响应 Response.Write("I could use some whiskey"); 中打印出文本。

当我在本地运行网站时,它可以很好地打印出响应,但是,在我的实际网站上,没有写入网页的响应。

这是我的项目中已发布的文件,我已上传到 FTP:

这应该很简单......但也许我不明白一些事情。我尝试过 YouTube 视频,但其中大多数都包括通过 VS 发布它们。我想使用 Core FTP 自己上传文件。谢谢!

【问题讨论】:

  • 查看下面的答案进行简单检查(索引/默认文档)。也就是说,如果您选择执行“核心 ftp”,那么您应该很好地了解您将上传(或不上传)什么、设置(调试与发布)等。Publishing isn't magical

标签: c# asp.net .net ftp


【解决方案1】:

您输入了您的 aspx 文件的 url 吗?如果不是,您的 index.html 可能是默认文档,因此 IIS 提供它而不是 aspx。将此代码上传到某个 hello.aspx 文件中,然后从浏览器中调用它。它会说 .NET 是否被正确配置为应用程序。

<%@ Page Language="C#"  %>
<%
    Response.Write("hello from NET " + System.Environment.Version.ToString() +"<br>");

    Response.Write("<br>HttpContext.Current.Server.MapPath:<br>" + HttpContext.Current.Server.MapPath("/")); // physical root of application
    Response.Write("<br>HttpRuntime.AppDomainAppPath:<br>" + HttpRuntime.AppDomainAppPath); // The filesystem folder containing your application
    Response.Write("<br>HttpRuntime.AppDomainAppVirtualPath:<br>" + HttpRuntime.AppDomainAppVirtualPath); //
    Response.Write("<br>Request.ApplicationPath :</strong><br>" + Request.ApplicationPath); // Gets the IIS root virtual path for your ASP.net application. ASP.NET transforms ~/ into this value when making an absolute virtual path.
%>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-23
    • 1970-01-01
    相关资源
    最近更新 更多