在线部署ASP.net(问题)

时间:2017-10-22 04:45:29

标签: c# asp.net .net ftp

问题:

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

项目:

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

当我在本地运行网站时打印出的回复很好,但是,在我的实际网站上没有写回网页的回复。

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

enter image description here

enter image description here

这应该很简单......但也许我不理解某些东西。我尝试过YouTube视频,但大多数都是通过VS发布。我想使用Core FTP自己上传文件。谢谢!

1 个答案:

答案 0 :(得分:0)

您输入了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.
%>