2017-10-22 174 views
0

问题:部署ASP.net在线(问题)

我想我的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自行上传文件。谢谢!

+0

查看下面的答案进行简单检查(索引/默认文档)。也就是说,如果你选择“核心ftp”,那么你应该很好地理解你将要上传(或不是),设置(调试vs释放)等。[发布不是神奇的](https:///stackoverflow.com/q/14102521/304683) – EdSF

回答

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. 
%>