【问题标题】:HowTo Publish ASP.NET Project on Web to work as it does locally?如何在 Web 上发布 ASP.NET 项目以在本地工作?
【发布时间】:2011-12-12 02:48:31
【问题描述】:

我刚刚遵循了一个创建数据库和两个 .aspx Web 表单的教程。当我在浏览器中查看 asp 页面时,它运行完美。但是当我 FTP 文件时:

默认.aspx
AddEntry.aspx
还有我的整个 App_Data 文件夹(带有 .mdf 和 .ldf 文件)

它不会在 URL 上查看。例如..当我去http://www.mysite.com/project/Default.aspx它不会加载我的网络表单...它只是显示原始文本说......

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!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 runat="server">
    <title></title>
</head>

等等。如何正确发布它,使其像我在本地查看时一样工作?

编辑:

还没有找到专家设置——还有……

我在一个网络服务器上试过这个,我很确定它安装了 ASP,它给了我一个错误:

Server Error in '/' Application

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

为什么????

【问题讨论】:

  • 另外,我正在使用 Visual Web Developer 2008 速成版
  • 您的机器和 IIS/您使用的任何网络服务器上是否安装了 ASP.NET?它在调试模式下运行良好吗?
  • 好像没有安装ASP.NET。
  • 您要发布到的文件夹需要设置为该服务器上运行的 IIS 下的虚拟文件夹。这是你做的吗?
  • Raze:我自己还没有在我的 Web 服务器上安装 ASP.NET。 (Godaddy) 但我确实看到我的主机包支持 ASP。是的,它在调试模式下运行良好。

标签: .net asp.net database


【解决方案1】:

您需要在服务器上正确配置站点。

最简单的方法是使用构建菜单中的发布网站命令。我认为您需要先在 WebDeveloper 中选择专家设置。

并且服务器需要为 ASP.NET 进行配置,只需在服务器上安装正确版本的 .NET,也许可以通过运行 ASPNET_REGIIS.exe 进行修复

【讨论】:

  • 我的构建菜单上没有发布网站命令。我正在使用 Visual Web Developer 2008 Express.. 也许这只是 Visual Studio 中的一个选项?
  • 不,这仅仅意味着您创建了一个“网站项目”而不是“Web 应用程序项目”。使用谷歌找出差异是什么。在“网站项目”中有另一个菜单点,称为“复制网站”
  • 我这里只有 WebDev 2010。构建菜单显示“发布 WebApplication1”。但是您找到专家设置了吗?
  • @citronas:这确实是另一种可能性。在“Web Site 项目”中,主菜单中有一个 WebSite 项。使用 Copy 项。
猜你喜欢
  • 2017-08-08
  • 1970-01-01
  • 1970-01-01
  • 2013-11-28
  • 1970-01-01
  • 1970-01-01
  • 2014-06-19
  • 2015-02-13
  • 1970-01-01
相关资源
最近更新 更多