我正在部署一个作为一组项目构建的站点,该解决方案被部署为一系列网站(一个项目=一个 url)。
编码语言是 c#,该站点使用通过 linq 访问的 mssql db。
在开发服务器上一切正常,但目前,所有具有动态创建元素的页面(即所有<asp>
和自定义标签)都会输出一个空白页面,其中包含以下源代码。静态页面(标准 html 和 aspx)正确显示。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type></HEAD>
<BODY></BODY></HTML>
我通常在 LAMP 上使用 php,这种行为不同于我在该设置中看到的任何东西。我需要一些关于此错误的原因/解决方案的新想法(最好是逐步/教程链接 - 就像我说的 IIS/c#.net 不是我的正常环境)。
我尝试过的事情没有任何效果:
- 更改站点文件夹的权限
- 更改 web.config 设置
- 通过复制/粘贴和具有各种设置的 vb 发布选项重新部署站点文件
- 加上一整吨(到目前为止超过两天)的互联网研究
感谢所有回复。
编辑:版本号:
iis: v6.1 (bulid: 7601) 操作系统: Windows web server 2008 R2 / Service pack 1 .net: v4
第二次编辑:
示例页面:
.aspx 文件:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="dbtest.aspx.cs" Inherits="Rica.Yoodul.dbtest" %>
<!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>
<body>
<form id="form1" runat="server">
<div>
<h1>test</h1>
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
</div>
</form>
</body>
</html>
aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
namespace Rica.Yoodul
{
public partial class dbtest : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection myConnection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["RicaConnectionString"].ConnectionString);
myConnection.Open();
SqlDataReader myReader = null;
SqlCommand myCommand = new SqlCommand("SELECT * FROM dbo.MaritialStatus", myConnection);
myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
Literal1.Text = Literal1.Text + myReader["Name"].ToString();
}
myConnection.Close();
}
}
}
编辑:
我没有添加的东西:基于服务器显示的其他一些行为,我认为最有可能的罪魁祸首是服务器配置错误。
编辑:
好的,我已经缩小了一些原因。通过在前端文件的第一行中取出除语言属性之外的所有内容,我可以让服务器显示静态内容。#
编辑:
OK http://www.iis.net/ConfigReference涵盖了 iis 配置文件的使用。只有我去了页面上指示的路径,我似乎根本没有任何配置文件。我该如何确认/解决这个问题?